Follow the below steps to change Volume Group Name. Here I’m going to change my VG name from centos to fedora-01

Step1: Change Volume Name

# vgs 
File descriptor 63 (pipe:[46003106]) leaked on vgs invocation. Parent PID 3767: -bash 
  VG     #PV #LV #SN Attr   VSize    VFree  
  centos   1   3   0 wz--n- <237.45g 56.00m
 
# vgrename -v centos fedora-01

Step2: Update /etc/fstab and Grub2 Configuration file. (Rename “centos” by “fedora-01” in both file. ` vim /etc/fstab`

/dev/mapper/centos-root /                       xfs     defaults        0 0 
UUID=b440cb14-f526-4b52-346c13653c45 /boot      xfs     defaults        0 0 
/dev/mapper/fedora-01/home /home                xfs     defaults        0 0 
/dev/mapper/fedora-01-var  /var                 xfs     defaults        0 0 
/dev/mapper/fedora-01-swap swap                 swap    defaults        0 0

vim /boot/grub2/grub.cfg

if [ x$feature_platform_search_hint = xy ]; then 
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  dff80ab9-f930-4c6b-bd1 
4-f758f7b14c13 
        else 
          search --no-floppy --fs-uuid --set=root dff80ab9-f930-4c6b-bd14-f758f7b14c13 
        fi 
        linux16 /vmlinuz-4.18.12-200.fc28.x86_64 root=/dev/mapper/fedora-01-root ro rd.lvm.lv=fedora-01/root rd.lvm.lv=fedora-01/swap rhgb quiet LANG=en_US.UTF-8 
        initrd16 /initramfs-4.18.12-200.fc28.x86_64.img 
}

Step3: Rebuild The Kernel initramfs File.
The Kernel initramfs image needs to be rebuilt to reflect the LVM Volume Group name change. The mkinitrd command will be used to accomplish this task which uses the “dracut” tool.

mkinitrd -f -v /boot/initramfs-$(uname -r).img $(uname -r)`
....
.......
*** Installing kernel module dependencies and firmware *** 
*** Installing kernel module dependencies and firmware done *** 
*** Resolving executable dependencies *** 
*** Resolving executable dependencies done*** 
*** Pre-linking files *** 
*** Pre-linking files done *** 
*** Hardlinking files *** 
*** Hardlinking files done *** 
*** Stripping files *** 
*** Stripping files done *** 
*** Creating image file *** 
*** Creating image file done ***

ls -al /boot/initramfs-*

-rw-------  1 root root 24426882 Mar 10 12:37 /boot/initramfs-4.18.12-200.fc28.x86_64.img

Step4: Now reboot the system.

reboot

Now you can see the new volume group name.

If you are facing any booting issue or error like “dracut-initqueue timeout – starting timeout scripts” messages in a loop while booting than download centos 7 iso, make USB Stick bootable and run in a rescue mode.

image-center

From the first menu choose the Troubleshooting option and press [enter] key to continue. On the next screen choose Rescue a CentOS system option and press [enter] key to move further. A new screen will appear with the message ‘Press the Enter key to begin the installation process’. Here, just press [enter] key again to load the CentOS system to memory. After the installer software loads into your machine RAM, the rescue environment prompt will appear on your screen. On this prompt type 1 in order to Continue with the system recovery process.

image-center

The rescue program will inform you that your system has been mounted under /mnt/sysimage directory.

I was getting “dracut-initqueue timeout – starting timeout scripts” error while booting the system because I forgot to update a new volume group name completely on grub.cfg file. Therefore, I edited the grub.cfg file again and made the necessary changes. After that, I re-generated initramfs for the rescue kernel using the current kernel from the Live boot.

cd /mnt/sysimage

vim /mnt/sysimage/boot/grub2/grub.cfg (edited grub.cfg file)

Regenerate the new initramfs for the rescue kernel with current kernel.   

/etc/kernel/postinst.d/51-dracut-rescue-postinst.sh  $(uname -r) /boot/vmlinuz-$(uname -r)

Now, reboot system.

reboot

Comments