Swap Management

Get swap

mcedit /proc/swaps
swapon -s

Gem all memory (swap, RAM)


Show logical volums

mcedit /etc/fstab

Create Swap File

Create swap file 1 GB

dd if=/dev/zero of=/swapfile bs=1024 count=1048576

Prepare the swap file using mkswap just as you would a partition, but this time use the name of the swap file

mkswap /swapfile

And similarly, mount it

swapon /swapfile

Open etc/fstab

mcedit /etc/fstab
/swapfile none swap sw 0 0

Save, Reboot. The /etc/fstab entry for a swap file would look like this:

/swapfile none swap sw 0 0

Remove Swap File

swapoff /swapfile
rm /swapfile

Open /etc/fstab

mcedit /etc/fstab

and remove the line

/swapfile none swap sw 0 0


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.