after creating a swap partion by by Gparted tool you need to turn swapping on that partition,
swapon /dev/sdb1
swapon -s will reveal all the swap partitions
instead of free -m you need to use the free command to see the total swap and it's usage
swapon -a enables swap from /etc/fstab
we need to update the /etc/fstab to make the newly created swap partition available after reboot
in nano ctrl+k for cut and ctrl+u for uncut and by this way you can copy the existing lvm based swap line and just replace the directory,ehich in my case is /dev/sdb1
swapoff /dev/sdb1 will release the swap on the device(device and file)
swapon -a will read the /etc/fstab again and the released swap will be activated again
to create a swap from shell
fdisk /dev/sdb
N for creating disk
T for making it swap
W for writing the partitioning table
swapon /dev/sdb1
if not succesful then try using mkswap /dev/sdb1
allocation of swap from a file
dd if=/dev/zero of=/root/swapfile bs 1024 count=524288
mkswap /root/swapfile
swapon /root/swapfile
swapon -s will show the swap
to make this parmanent modify the /etc/fstab file
it will be like
/dev/mapper/debian5-swap_1 none swap sw 0 0
/dev/sdb1 none swap sw 0 0
/root/swapfile swap swap defaults 0 0
swapon -a will read the /etc/fstab and show the 3 swap
swapoff -a will disable every swap in /etc/fstab
swapon -a will enable the swap in/etc/fstab
No comments:
Post a Comment