Wednesday, March 16, 2011

Swap file creation & Swap partition creation


Step:1 Adding virtual memory (adding swap file)

#dd if=/dev/zero of=/var/local/swapfile bs=1k count=1M (creating a file)
#mkswap /var/local/swapfile

Step:2 add an entry to /etc/fstab

/var/local/swapfile    swap    swap    defaults    0 0

Step:3 enabling the swap partitions

#swapon -a (enabling all swap partitions)
#swapon -s
(showing all swap partitions)

 Creating swap partition
 
1.create a partition (eg:/dev/sda6)
2.#mkswap -L swap2 /dev/sda6 (creating a partition and label as swap2)

add an entry to /etc/fstab
LABEL=swap2    swap    swap    defaults    0 0
save and quit /etc/fstab

#swapon -a (enabling all swap partitions.)
#swapon -s
(showing all swap partitions)

1 Comment:

கடவுளன் said...

Super swap partition creation. It works great. Thanks Mr.PNA Prasanna.