Ubuntu 14.04 and up: Rename a volume group containing root

When checking my cloned Ubuntu 14.04 LTS VM, I noticed that it still contained the volume group name from the original, which is of course not desired.

It seemed fairly simple, but I kept receiving an error with update-grub, reporting the old Volume Group name:

/usr/sbin/grub-probe: error: failed to get canonical path of `/dev/mapper/<Old VG>-root'.

Steps to be done as root:

#Show the current VG name 
>vgs 
#Proof that it really is used 
>ls -als /dev/mapper/
#Do the rename 
>vgrename -v <old VG> <new VG> 
#Replace all references to the old VG with the new ones in fstab: 
>nano /etc/fstab 
#This will give an error as Ubuntu 14.04 LTS still finds the old VG name (no idea why) 
>update-grub 
#So, replace all references directly in the one that is going to be used in the next reboot 
>nano /boot/grub/grub.cfg 
#Be brave 
>reboot now 
#New session: 
#This command does nothing 
>update-grub 
#This shows that the VG really is renamed 
>ls -als /dev/mapper

 

Share