Renaming the root volume group
A few days ago, I installed Ubuntu 14.04 on my laptop.
Usually, I use several partitions to separate
/home. I do this with
LVM2, so I can adjust the
partition sizes later on, if necessary.
After the installation, I wanted to rename the volume group from the
ubuntu-vg to a plain
vg0. Here is how I did this.
First, I booted into recovery mode and started a root shell. The root partition was mounted readonly. To modify anything, I had to remount it read-write
mount -o remount,rw /
Now, I can already rename the volume group with
vgrename ubuntu-vg vg0
With this rename alone, the system is unbootable, because Grub and the
initial mount still search for the previous default name
ubuntu-vg. To fix this, I needed to adjust the
mv /etc/fstab /etc/fstab.orig sed -e 's/ubuntu--vg/vg0/' /etc/fstab.orig >/etc/fstab
and the Grub config file
mount -o rw /boot mv /boot/grub/grub.cfg /boot/grub/grub.cfg.orig sed -e 's/ubuntu--vg/vg0/' /boot/grub/grub.cfg.orig >/boot/grub/grub.cfg
If you don’t have a separate
/boot partition, you can omit the
mount, of course.
This is all to rename the root volume group. I like to remount the partitions readonly first
mount -o remount,ro /boot mount -o remount,ro /
Now you can reboot the system.