Techie:Techie Main/Linux/Increasing Swap Space
< Techie:Techie Main | Linux
Increasing swap partition size
Preferable if that's an option but not detailed here
Adding an extra swap file
There is [http://www.linux.com/archive/feature/113956
| a good article on linux.com] about this.
It boils down to
- Check existing swap space
- /sbin/swapon -s
- Decide where to put swap file (assume /extraswap for this example)
- df -m
- Backup important data just in case
- Swap to root user
- sudo su -
- Create file initially full of zeros
- dd if=/dev/zero of=/extraswap bs=1M count=512
- Prepare file as a swap file
- mkswap /extraswap
- Turn on our swap file
- swapon /extraswap
- Check it's ok
- /sbin/swapon -s
- should include /extraswap in list
- free
- should show expected increase in swap space
- /sbin/swapon -s
- add /extraswap to /etc/fstab so that it's still there when we reboot
- cp /etc/fstab /etc/fstab.mybackup
- add following line to /etc/fstab underneath existing swap entries
- /extraswap none swap sw 0 0