If you are planning to use a swap partition for virtual RAM, you're
ready to prepare it for use. In Chapter 4
we will discuss the preparation of a swap file in case you don't want
to use an individual partition.
Many distributions require you to create and activate swap space before installing the software. If you have a small amount of physical RAM, the installation procedure may not be successful unless you have some amount of swap space enabled.
The command used to prepare a swap partition is mkswap, and it takes the form
where <partition> is the name of the swap partition, and <size> is the size of the partition, in blocks.mkswap -c <partition> <size>
The -c option tells mkswap to check for bad blocks on the partition when creating the swap space.# mkswap -c /dev/hda3 10336
If you are using multiple swap partitions, you will need to execute the appropriate mkswap command for each partition.
After formatting the swap space, you need to enable it for use by the system. Usually, the system automatically enables swap space at boot time. However, because you have not yet installed the Linux software, you need to enable it by hand.
The command to enable swap space is mkswap, and it takes the form
In the example above, to enable the swap space on /dev/hda3, we use the commandswapon <partition>
# swapon /dev/hda3