Creating swap partitions

Swap partitions are necessary if you want your Linux system to have access to virtual memory. Virtual memory is a section of the hard disk designated for use as memory when the main system memory (the RAM) is all in use. The common formula for determining the amount of swap space you need has usually been twice the amount of RAM your system has. Although swap is not required by Linux, at least 128 MB is recommended for some spooling functions. On the other hand, memory-intensive applications may recommend much more, based on variables such as the number of users, database tables/sizes, or other application configuration guidelines. It is important to know what the system will be used for when considering swap space.

The command to create a swap partition is mkswap. This command prepares a partition for use as Linux swap space and is needed if you plan to fully configure a disk from scratch. It is also required if you need to add an additional swap partition.

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.