- First you have to create the file. The size of a swap should be equal to a memory size (of course if you have a lot of memory you don't need swap). In example, we are creating 256Mb swapfile:
dd if=/dev/zero of=/swapfile bs=1M count=256
- Now, we are creating swap on our file:
mkswap /swapfile
- Next we have to edit the /etc/fstab file, by adding:
/swapfile none swap defaults 0 0
- After that, we can easily turn on our swapfile:
swapon -a
- It will be nice to have swap turning on it the time of system start. To get this we have to edit the /etc/rc. In the standard Crux configuration a swap is turn on before mounting filesystems. To change it we move
# Activate swap /sbin/swapon -a
after lines which mounting partition where our swapfile is:# Mount local filesystems /bin/mount -n -o remount,rw / /bin/rm -f /etc/mtab* /bin/mount -a -O no_netdev
Kind of my extended memory with thoughts mostly on Linux and related technologies. You might also find some other stuff, a bit of SF, astronomy as well as old (quantum) chemistry posts.
Search This Blog
Monday, November 28, 2005
[Not only] Crux and swapfile
I prefer swapfile to swap partition in Linux. The file is much more flexible and have the same performance (in 2.6 kernel). The way to create swapfile in Crux is standard, but you have to hack /etc/rc file to make in turning on in the system start sequence (see point 5).
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment