Sunday, March 17, 2013

How To: Create swap file in Ubuntu 11.04


1.       Open Terminal by pressing alt+ctrl+t
2.       Enter the command
               cat /proc/meminfo
3.       Now enter
                sudo dd if = /dev/zero of=/swapfile bs=1024 count=XX
                 swapfile size = count * bs
                e.g. count=2M  OR count = 2048K
                   so size=1024 * 2M = 2GB
4.       sudo chmod 600 /swapfile && sudo mkswap /swapfile
5.      sudo swapoff -a
6.      sudo swapon /swapfile
7.      sudo -b gedit /etc/fstab
                edit /etc/fstab file and remove or comment out all old swap partitions
8.       Add new line:
                /swapfile none swap sw 0 0
                verify that everything is done OK
9.     free -m
10.   Now you'll see your swap reported
                   swapon -s


No comments:

Post a Comment