Solved: rename root volume group

General support questions
Post Reply
gwiesenekker
Posts: 6
Joined: 2009/08/09 10:04:26

Solved: rename root volume group

Post by gwiesenekker » 2016/03/08 08:17:00

Hi,

After cloning a VM the name of the root volume group still referred to the original hostname so I wanted to rename it. The instructions I googled were not up to date for Centos 7 but these are:

Boot into Rescue mode and choose option 3 'Skip to shell'.
Check the name of the existing root volume group:
# vgdisplay
Rename the root volume group:
# vgrename <OLD NAME> <NEW NAME>
Activate it:
# vgchange -ay
Check the name of the root logical volume:
# lvdisplay
Mount the root logical volume and /boot:
# mount /dev/<NEW NAME>/root /mnt/sysimage
# mount /dev/sda1 /mnt/sysimage/boot
Prepare for dracut -f:
# mount --bind /proc /mnt/sysimage/proc
# mount --bind /dev /mnt/sysimage/dev
# mount --bind /sys /mnt/sysimage/sys
# chroot /mnt/sysimage
Change all references to the old name of the root volume group to the new name in these files:
# vi /etc/fstab /etc/default/grub /boot/grub2/grub2.cfg
# dracut -f
# exit
$ Reboot

Gijsbert

ITI
Posts: 23
Joined: 2014/02/26 20:19:38
Location: Canada
Contact:

Re: Solved: rename root volume group

Post by ITI » 2016/09/26 16:33:53

Thanks for the post.

On a fresh install (CentOS 7.2.1511) I don't have:
vi /etc/fstab /etc/default/grub /boot/grub2/grub2.cfg

I do have /boot/grub2/grub.cfg
Is this just a typo in your post or should grub2.cfg exist in addition to grub.cfg?

Thanks
Glen

orever
Posts: 10
Joined: 2005/11/03 19:44:29

Re: Solved: rename root volume group

Post by orever » 2017/02/17 02:13:50

I know this is a bit of an old post, but I wanted to say that it worked very well for me.

And yes, the grub filename is /boot/grub2/grub.cfg, though I do think you might be able to skip editing that file directly. You can probably edit /etc/fstab and /etc/default/grub, then run "grub2-mkconfig -o /boot/grub2/grub.cfg". I did not test that procedure out though.

ITI
Posts: 23
Joined: 2014/02/26 20:19:38
Location: Canada
Contact:

Re: Solved: rename root volume group

Post by ITI » 2017/04/30 18:28:28

If you are reading this post you may also want to have a look at what I think is a better way.
Renaming the Volume Group the right way
Glen

Post Reply

Return to “CentOS 7 - General Support”