Wednesday, September 2, 2009

Make a file system as swap

Make a file system as swap

use fdisk to create a partition

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (197-621, default 197):<RETURN>
Using default value 197
Last cylinder or +size or +sizeM or +sizeK (197-621, default 621): +128M


Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap)
Command (m for help): p

#

Now that you have the swap partition, use the command mkswap to setup the swap partition. At a shell prompt as root, type the following:

mkswap /dev/hdb2

#

To enable the swap partition immediately, type the following command:

swapon /dev/hdb2

#

To enable it at boot time, edit /etc/fstab to include:

/dev/hdb2               swap                    swap    defaults        0 0

The next time the system boots, it will enable the new swap partition.
#

After adding the new swap partition and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free

No comments:

Post a Comment