April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Rename Root Volume Group (VG) on Linux Server

This walk-through worked on a virtual server running RHEL 6.7 in a VMware environment.

As I rebuilt an existing VMware guest that was being scheduled to go into production, I realized I did not rename the default volume group from vg_hostname to rootvg.

You must be root user and it is extremely important to backup the files below. It’s also important to know how to boot up in rescue mode with other boot media in the event there was a typo or other unforeseen issue.

Backup fstab file

cp /etc/fstab /etc/fstab.orig

Backup grub.conf file

cp /boot/grub/grub.conf /boot/grub/grub.conf.orig

Rename volume group

vgrename /dev/vg_OLDname /dev/rootvg

Change all instances of the old volume group in the following files:
Edit /etc/grub.conf (which is a symbolic link to /boot/grub/grub.conf)

vim /etc/grub.conf

Search and replace

:%s/vg_OLDname/rootvg/g

Edit fstab file

vim /etc/fstab

Search and replace

:%s/vg_OLDname/rootvg/g

Move boot image

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.backup
dracut -v /boot/initramfs-$(uname -r).img $(uname -r)

Verify your work
Reboot

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>