Add Swap on Linux

From: FelipeCruz

To add swap partition use command

# mkswap /dev/hdb2
# swapon /dev/hdb2
# vi /etc/fstab
# /dev/hdb2   swap   swap   defaults   0 0

With assuming you already create /dev/hdb2 partition before using fdisk and chose swap filesystem.

To add a swap file:

# dd if=/dev/zero of=/swapfile bs=1024 count=65536
# mkswap /swapfile
# swapon /swapfile
# vi /etc/fstab
#  /swapfile   swap   swap    defaults        0 0

Check swap status:

# cat /proc/swaps
# free
SocialTwist Tell-a-Friend

Related posts:

  1. Check Linux Foldersize I don’t know if there are any utilities out there...
  2. hdd partition for cpanel server Simple Harddisk partition, assume only for vps and have or...

Leave a Reply