wiki:swap

Swapfile

If you use vfat see swap below

Create a swap file

The following assumes that you create a swap file in /media/card/swap. Use a different location throughout the following if you want a different path.

  1. Create a file the size of your swap file (64MB here)

dd if=/dev/zero of=/media/card/swap bs=1M count=64

  1. Make that file be a swap file:

mkswap /media/card/swap

  1. Turn it on (immediately until you reboot)

swapon /media/card/swap

  1. Add this line to /etc/fstab to make your swap file known after reboots:

/media/card/swap none swap defaults 0 0

TODO: Check that SHR actually turns on Swap files on boot by default

  1. You (most probably) do not want to swap to your SD card unless really needed (for speed reasons and to avoid high wear on your card), you should configure your "swappiness" to be 0. This means the swap file will only be used if the RAM is absolutely full.
    • Check your current swappiness value: cat /proc/sys/vm/swappiness If it is different from 0, you can set it until the next reboot, by doing the following as root echo 0 > /proc/sys/vm/swappiness
    • To make your change permanet across reboots, you can set the swappiness in /etc/sysctl.conf vm.swappiness=0 Modify the value if the line is already there, or simply add the line to the end of the file if it's not there yet. Do note that the swappiness value is valid for all existing swap files on the system.

Troubleshooting

  • Some have experienced this: The first time I arrived at the point 3 then the console freezed and my fr went to the kernel panic (red light on the aux button) So I restarted my phone and I made the point 4 and 5. I rebooted and the phone was stuck in the console. Therefore I decided to reflash the new image. With the fresh image I remade the process from 1 to 5, except 3, then I rebooted and again the phone stucks in the console. This happened on a SD card that was vfat-formatted. Once it was formatted as ext3, it worked.