Saturday, November 21, 2009

Swap Partition And Swap File In RHEL 4

Swap Partition And Swap File In RHEL 4

#swapoff –a

# fdisk /dev/hda

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

#mkswap –v1 /dev/hda15

-v1 switch is used for version number.

Add an entry in /etc/fstab file

# vi /etc/fstab

/dev/hda15 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

 
Things You Should Know About Linux !!!