Creating a swap partition
To perform this procedure, you need:
- A host with one or more local disks, with at least one unused primary partition.
- The password of the root account on the host or a user that is a member of the wheel group.
Perform this procedure to configure a primary partition on a local disk as swap space. Typically, configuring one swap partition or swap file on each local disk maximizes swap space performance.
- Log in to the target host as root, or as a user with superuser privileges.
Identify one or more primary partitions for use as swap space.
lsblk -p --output=NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT
Create and enable swap space on each target primary partition.
Disable swapping on all swap devices.
Create swap space.
Repeat the following command for each primary partition to use as swap space.Replace Device with the path of a primary partition:
Update the file system table.
Repeat the following command for each swap partition created in the previous substep.Replace Device with the path of a swap partition:
echo "Device swap swap defaults 0 0" >> /etc/fstab
Enable swapping on all swap devices.
- Disable swapping on all swap devices.