How to Format a Swap Partition

The Linux operating system uses swap partitions and files to reserve space so that the kernel can quickly swap pages from the RAM to a disk. Swap space is automatically created when the operating system is installed. You can format a swap partition using the "mkswap" command. This command does not add a file system to the partition, but tells the operating system to use it as swap space. You will have to tell the operating system to use the new swap space with the "swapon" command.

Instructions

    • 1

      Open a terminal window. The terminal program is called "Terminal," "XTerm" or "Konsole," depending on the distribution you are using.

    • 2

      Type the command "su" to become the root user. Type the root password, when prompted.

    • 3

      Type the command "fdisk -l" to locate the device name for the partition you are going to format. The device name will look like "/dev/sda5" and will be the first portion of the line.

    • 4

      Type the command "mkswap /dev/sda5" to format the swap partition.

    • 5

      Type the command "swapon -a" to instruct the operating system to use the newly created swap partition.

Tips & Warnings

  • The mkswap command will erase all data on the partition. Use it with caution.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured