Friday, August 21, 2015

RHEL7 - Add swap partition to the system

Create a swap partition 2gb and make it to survive upon reboot

1. If its a new partition, scan it or if its already existing disk, just use the disk and create a new partition or a extended partition.

a. Scan
# echo "- - -" >
b. Create partition
# fdisk /dev/sdb
note: select a partition #3, size 2GB and select type as 82 - swap partition
# fdisk /dev/sdb
# partx /dev/sdb
# fdisk -l
# reboot -> if needed
note: if you are creating a partition on an active disk, you have to reboot the system.

2. Make partition as swap device
# mkswap /dev/sdb3
# swapon /dev/sdb3
# swapon -a

3. Add entry to fstab
# blkid /dev/sdb3
# vi /etc/fstab
UUID=<UU_ID> swap swap defaults 0 0

4. Verigy if its added
# free -m
# swapon -s

No comments:

Post a Comment