Enable swap
From ComputingPlugs
The Sheeva Plug comes with 512MB of memory, which is a generous amount and should be enough for most people. However, if you have a large USB storage attached, then it doesn't hurt to have a bit of swap space "just in case". I don't really recommend swap on flash base storage because of possible wearing, but I'll leave that up to you.
There are two types of swap; swap partition and swap file. Swap partitions is dedicated space on the storage for swap while a swap file is swap space that is stored as a file on top of an existing partition. Swap partitions is slightly faster because it doesn't have to work on top of a file system. Swap file is nice because you don't have to allocate space on the storage before hand and you can easily delete it if you run out of space.
To create a swap partition on the Sheeva Plug, follow these instructions. The instructions will create a swap partition at /dev/sda3.
To create a swap file, type:
dd if=/dev/zero of=/dev/swapfile bs=1k count=512000
That will create a 512Mbyte swap file in /dev/swapfile.
Next you need to initialize the swap with:
mkswap /dev/sda3 -or- mkswap /dev/swapfile
Then enable the swap with:
swapon /dev/sda3 -or- swapon /dev/swapfile
If you've done everything correctly, swap will be working. You can check by:
cat /proc/meminfo ... SwapTotal: 907664 kB SwapFree: 907664 kB ...
The next thing to do is to put the swap information in /etc/fstab so that it will enable the swap at boot. Edit /etc/fstab and add the line:
/dev/sda3 none swap sw 0 0 -or- /dev/swapfile none swap sw 0 0
Make sure you pick one or the other. Make sure to change the name of the mount point if you put the swap file or partition somewhere else besides /dev/sda3 and /dev/swapfile
|
|
Click here to leave a comment
Did you find this page useful? |
||


May 18 2009 3:46 pm
Please keep comments clean and constructive. Inappropriate comments will be removed. Thank you.
Aug 10 2009 4:44 am
This didn't work for me when I tried to create the swapfile under /dev/swapfile, gave error invalid argument when entering "swapon /dev/swapfile", I got it to work by creating the file /swapfile, works now.
Aug 10 2009 12:27 pm
hmmm... Good to know, thanks.
Aug 19 2009 12:49 pm
> I got it to work by creating the file /swapfile, works now. will this be mounted too by using /ets/fstab ?
Aug 19 2009 11:27 pm
I don't see why not, its just a mount point like everything else....
Sep 15 2009 2:40 pm
Hi love your summary :)
I have a 16GB SD card with 2 Partitions. The second partition is a swap partition type 82.
It is listes under "top" but it never gets used !? Is there any way of forcing the Sheeva to use it?
my fstab:
/dev/mmcblk0p2 none swap sw 0 0
my free:
Mem: 513752k total, 203164k used, 310588k free, 6544k buffers
Swap: 1005528k total, 0k used, 1005528k free, 167076k cached
my fdisk:
Disk /dev/mmcblk0: 16.0 GB, 16062087168 bytes
4 heads, 16 sectors/track, 490176 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Disk identifier: 0x15fe73a8
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 1 458753 14680095+ 83 Linux
/dev/mmcblk0p2 458754 490176 1005536 82 Linux swap / Solaris
Sep 21 2009 10:30 pm
I don't think there is a way to force Linux to use swap. Seeing that free gives you the correct swap size, I'm pretty sure it'll use it when you run out of real memory. If you haven't already, install X and VNC, that'll guarantee the Sheeva Plug will use swap. :D