Swap

From OLPC
Revision as of 21:21, 27 December 2007 by 68.0.226.163 (talk) (Swap doesn't work, but here's a script anyway)
Jump to: navigation, search

see the Support FAQ for more on setting up an SD card or other device as swap.

Swap on SD is currently is broken. The XO currently force-unmounts the SD card at suspend, which loses the swap file and breaks all applications that touched the swap, most notoriously X11.

Swap on the internal memory doesn't work either, it causes system freezes. Swap doesn't even like attaching to a jffs2 file, but can be forced by using a loopback device. The internal flash chip is only rated for 3000 writes/cell (Remember when flash could take 100,000 writes? Now we're giving that up for density). JFFS2 will try to spread that across the whole chip, even then swap write patterns are likely bad for it. Try the following at your own risk.

su
dd if=/dev/zero of=/var/swap count=128000
/sbin/mkswap /var/swap
#!/bin/sh
if [ `cat /proc/swaps | wc -l` == 1 ] ;then
    loopdev=`su -c "/sbin/losetup -f"`
    su -c "/sbin/losetup $loopdev /var/swap"
    su -c "/sbin/swapon $loopdev"
fi