This morning I went through a tiny adventure of having renamed my boot logical volume without updating the /etc/fstab
file, and in the process, I broke my system and simultaneously figured out there are quite a few more things I had to do. So, if you ever want to rename a logical volume, here’s how you do it.
- Boot into rescue mode using the install media. When you are given an option to Skip, choose #3 for skipping.
- Run
vgsan
to detect the volume group that you want to rename. - Type
vgchange -ay /dev/<volume_group
to activate the volume group. - Type
vgrename <old_name> <new_name>
- We need to prepare the system now to recognize the new volume group name. Failing to do so will prevent the system from booting.
# mount /dev/mapper/<volume_group>-root /mnt/sysimage# mount /dev/<boot_volume> /mnt/sysimage/boot# mount -o bind /dev /mnt/sysimage/dev# mount -o bind /proc /mnt/sysimage/proc# mount -o bind /sys /mnt/sysimage/sys
- Chroot into the volume by typing
chroot /mnt/sysimage
- Edit the
/etc/fstab
with the new volume group name. - Rebuild the initramfs by doing the following:
# cd /boot# dracut -f initramfs-<kernel_version> kernel_version
- Change the volume names in
/etc/default/grub
and rungrub-mkconfig -o /boot/grub2/grub.cfg --update-bls-cmdline
. - Reboot – Done. Your volume group is renamed and you should be able to boot into your system now.