Black Cat Blog

Thoughts, Stories, and Ideas

Renaming A Logical Volume On Alma Linux 9

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.

  1. Boot into rescue mode using the install media. When you are given an option to Skip, choose #3 for skipping.
  2. Run vgsan to detect the volume group that you want to rename.
  3. Type vgchange -ay /dev/<volume_group to activate the volume group.
  4. Type vgrename <old_name> <new_name>
  5. 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
  1. Chroot into the volume by typing chroot /mnt/sysimage
  2. Edit the /etc/fstab with the new volume group name.
  3. Rebuild the initramfs by doing the following:
# cd /boot# dracut -f initramfs-<kernel_version> kernel_version
  1. Change the volume names in /etc/default/grub and run grub-mkconfig -o /boot/grub2/grub.cfg --update-bls-cmdline.
  2. Reboot – Done. Your volume group is renamed and you should be able to boot into your system now.

Leave a Reply

Your email address will not be published. Required fields are marked *