How to add more swap space in linux.
- June 25th, 2010
- Posted in Documentation
- Write comment
I used this procedure to add swap space to a server, where I not more available partitions, but had space on a previously formated partition.
# mkdir /var/swap
Create container files:
# dd if=/dev/zero of=/var/swap/swapfile1 bs=1024 count=65536
# dd if=/dev/zero of=/var/swap/swapfile2 bs=1024 count=65536
# dd if=/dev/zero of=/var/swap/swapfile3 bs=1024 count=65536
# dd if=/dev/zero of=/var/swap/swapfile4 bs=1024 count=65536
Format as swap:
# mkswap /var/swap/swapfile1
# mkswap /var/swap/swapfile2
# mkswap /var/swap/swapfile3
# mkswap /var/swap/swapfile4
Add them to startup:
# vi /etc/fstab
…
/var/swap/swapfile1 swap swap defaults 0 0
/var/swap/swapfile2 swap swap defaults 0 0
/var/swap/swapfile3 swap swap defaults 0 0
/var/swap/swapfile4 swap swap defaults 0 0
…
Enable them:
# swapon -a
Check them:
# swapon -sh
No comments yet.