Changing the volume name on an LVM machine

Changing the volume group name on an LVM machine is easy, but doing it so that it doesn’t break everything is hard. Here are some pointers on how to change the volume group name on an Ubuntu LVM machine.

First, use


to show your current volume groups, choose the one you want to rename and rename it using vgrename.

vgrename oldname newname

Now you need to edit /etc/fstab to replace the old name with the new one everywhere in that file.

vi /etc/fstab

Edit /boot/grub/grub.cfg and do the same thing

perl -i.old -npe 's/oldname/newname/g' /boot/grub/grub.cfg

Update the image ram disk:

update-initramfs -u   (this updates the current version)

And reboot.

It may well crash here, especially if the volume name has changed. If you end up in busybox, look in /dev/mapper and see what the volume is called. Next, reboot the machine (you probably need to power cycle it for this), and then when the grub menu comes up listing your machines, edit the line that says linux /dev/mapper/…. so that the name listed there is the same as the one you saw.

You should be able to reboot now, and then run


Finally, check that the name you provided in /etc/fstab was correct (mine was not, so I re-edited that file).