Linux Server and Workstation Configuration How To

  • Decrease font size
  • Default font size
  • Increase font size
  • default color
  • red color
  • green color
Home Manual Linux, UNIX Swap Management
Swap Management PDF Print E-mail
Thursday, 03 December 2009 12:17
AddThis Social Bookmark Button

Get swap

# mcedit /proc/swaps

# swapon -s

Gem all memory (swap, RAM)

# /proc/meminfo

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
 

Add comment


Security code
Refresh

Useful Links

Follow us on ...

  • Digg: hgevs
  • Facebook Page: 180986722511
  • Linked In Group: 2571120
  • Ning: linuxconfignet
  • Twitter: linuxconfignet

Friends

Thanks David Ayvazyan for provided useful information and discussions.
www.gnu.am (Armenian Translation)