CentOS / RHEL 6 : How to Change the Volume Group Name for Root Disk Device

The post describes the renaming of the volume group (vg) being used for the root file system. For example purpose we will be renaming the disk group from vg_old to vg_new.

Steps

1. Rename the Volume Group from vg_old to vg_new :

# vgs
  VG         #PV #LV #SN Attr   VSize VFree
  vg_old   1   2   0 wz--n- 7.88G    0
# vgrename  vg_old vg_new
  Volume group "vg_old" successfully renamed to "vg_new"
# vgs
  VG            #PV #LV #SN Attr   VSize VFree
  vg_new   1   2   0 wz--n- 7.88G    0

2. Replace references to the old VG name ( vg_old ) with the new VG name ( vg_new ) in the files /etc/fstab and /boot/grub/grub.conf. I have changed the 2 references (for swap and root filesystem) with the new disk group name vg_new (highlighted).

# cat /etc/fstab
/dev/mapper/vg_new-lv_root    /                       ext4    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/mapper/vg_new-lv_swap    swap                    swap    defaults        0 0

Similarly do the changes in /boot/grub/grub.conf :

# cat /boot/grub/grub.conf
...
 kernel /vmlinuz-2.6.32-642.1.1.el6.x86_64 ro root=/dev/mapper/vg_new-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_new/lv_root rd_NO_MD rd_LVM_LV=vg_new/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
...

3. Create a New Ramdisk Image:
Run the following commands to make a new initial ramdisk image. It is recommended you make a backup copy of the initrd in case the new version has an unexpected problem:

# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

Now rebuild the initramfs for the current kernel version:

# dracut -f

4. Reboot the server.

# shutdown -r now
Related Post