Swap Space

Have you ever wanted to change the amount of swap space on your VM ? Here's how to !

disable existing swap
# free -k
# swapoff -a
# free -k


get some more disk space
Either repartition an existing disk or add a new disk to your GNU/Linux machine or VM
and use fdisk to create/repartition a swap partition (type 82) for your swap space
# fdisk /dev/mydisk

verify
# fdisk -l /dev/mydisk

Disk /dev/mydisk: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/mypart1            1         261   2096451   82  Linux swap / Solaris


make a swap partition and use a speciail swap disk label !
# mkswap -L myswap /dev/mypart1


add to fstab
Add swap partition to fstab using your special swap disk label !
# vi /etc/fstab
LABEL=myswap         swap                    swap    defaults        0 0


reenable swap
# swapon -a
# free -k


reboot (optional)
Finally reboot to check new swap area gets picked up on reboot !
# reboot


and login and check new swap space is available
# free -k



REFERRERS
SystemServices
Comments [Hide comments/form]
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki