RHCSA 5.4: Adding storage and swap without data loss
A swap partition in the free space of a disk that holds data, swap on a new logical volume, and removing swap cleanly.
Before you start
The lab adds two 1 GiB spare disks. They're image files under
/var/lib/le-lab/disks/, attached again at every boot, before file
systems and swap are activated.
/dev/loop40has a GPT table with one 300 MiB partition,/dev/loop40p1, holding an ext4 file system with data. The rest of the disk is free./dev/loop41is a physical volume of the volume groupvglab, with a logical volumelvdataand a 128 MiB swap logical volumeoldswap, active and in/etc/fstab, as task 2 leaves a swap LV. Task 3 removes it, so task 2's result can stay.
Tasks
- On
/dev/loop40, add a 512 MiB swap partition in the free space and make it active at every boot. The first partition and its data must stay unchanged. - Add a 256 MiB swap space on a new logical volume in
vglab, active at every boot. - Remove the swap LV
oldswapcleanly: not active, the LV gone, no fstab line naming it, and noTimed out waiting for deviceerror at the next boot.
Hints
fdiskorparted: a new partition after the first; type Linux swap.mkswap, a lineUUID=... none swap defaults 0 0,swapon -a,swapon --show.lvcreate -L 256M -n,mkswap, a line in/etc/fstab.swapoff, then remove its line from/etc/fstab,systemctl daemon-reload, thenlvremove.journalctl -b -p errafter a reboot.