Rename VGS on CentOS/RHEL 6

Scenario: How to rename root VGS on CentOS/RHEL 6
System: CentOS 6/RHEL 6
Downtime: yes

Steps:
1. Rename the Volume Group from vg_old to vg_new :

[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_squid-lv_root
 4.7G 2.3G 2.2G 52% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 477M 134M 318M 30% /boot
/dev/mapper/vg_squid-lv_opt
 4.7G 292M 4.2G 7% /opt
/dev/mapper/vg_squid-lv_var
 9.5G 239M 8.8G 3% /var
[root@localhost ~]# vgs
 VG #PV #LV #SN Attr VSize VFree
 vg_squid 1 4 0 wz--n- 39.51g 16.04g
[root@localhost ~]# vgrename vg_squid vg_os
 Volume group "vg_squid" successfully renamed to "vg_os"
[root@localhost ~]# vgs
 VG #PV #LV #SN Attr VSize VFree
 vg_os 1 4 0 wz--n- 39.51g 16.04g
[root@localhost ~]#

2. Edit by replace references to the old VG name ( vg_squid ) with the new VG name ( vg_os ) in the files /etc/fstab and /boot/grub/grub.conf.

[root@localhost ~]# vi /etc/fstab
/dev/mapper/vg_os-lv_root / ext4 defaults 1 1
UUID=54b24383-bbb5-4763-82ac-b041593914a7 /boot ext4 defaults 1 2
/dev/mapper/vg_os-lv_opt /opt ext4 defaults 1 2
/dev/mapper/vg_os-lv_var /var ext4 defaults 1 2
/dev/mapper/vg_os-lv_swap swap swap defaults 0 0
[root@localhost ~]# vi /boot/grub/grub.conf

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/mapper/vg_squid-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-696.6.3.el6.x86_64)
 root (hd0,0)
 kernel /vmlinuz-2.6.32-696.6.3.el6.x86_64 ro root=/dev/mapper/vg_os-lv_root rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_os/lv_root rd_LVM_LV=vg_os/lv_swap rd_NO_DM rhgb quiet
 initrd /initramfs-2.6.32-696.6.3.el6.x86_64.img
title CentOS (2.6.32-431.el6.x86_64)
 root (hd0,0)
 kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/vg_os-lv_root rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_os/lv_root rd_LVM_LV=vg_os/lv_swap rd_NO_DM rhgb quiet
 initrd /initramfs-2.6.32-431.el6.x86_64.img

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:

 [root@localhost ~]# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak 

Rebuild the initramfs for the current kernel version,run command:

[root@localhost ~]# dracut -f

4. Reboot the server.

[root@localhost ~]# reboot now

Reference:
https://www.thegeekdiary.com/centos-rhel-6-how-to-change-the-volume-group-name-for-root-disk-device/


1 thought on “Rename VGS on CentOS/RHEL 6

  1. proxy list

    Hi,I read your blogs named “Rename VGS on CentOS/RHEL 6 – toyaseta.com” regularly.Your writing style is witty, keep up the good work! And you can look our website about proxy list.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *