Thursday, August 2, 2012

Swap Partition And Swap File


Swap Partition And Swap File

#swapoff –a

# fdisk /dev/sda

Create a new partition of 2*RAM and assign the id 82 which is allocated for swap partition.

#mkswap –v1 /dev/sdaX

-v1 switch is used for version number.

Add an entry in /etc/fstab file

# vi /etc/fstab

/dev/sdaX     swap  swap  defaults        0 0

Activate the swap partition using

#swapon –a (which reads /etc/fstab and turns on all the swap entries in the list.

# swapon –s (is used to check the status of swap partition.)

Creating a swap file

#swapoff –a

#dd if=/dev/zero of=swapfile bs=512M count=1

#mkswap –v1 /root/swapfile

Add an entry in the /etc/rc.local

#vi /etc/rc.local

Swapon /root/swapfile

No comments:

Post a Comment