Saturday, June 2, 2018

Renaming a volume group in RHEL/CentOS 6


1. Verify old name
# vgs

2. Rename VG
# vgrename old_vg_name new_vg_name

3. Backup and replace references in fstab
# cp -p /etc/fstab /etc/fstab.$(date +%F)
# grep old_vg_name /etc/fstab
/dev/mapper/old_vg_name-lv_root    /                       ext4    defaults        1 1
/dev/mapper/old_vg_name-lv_swap    swap                    swap    defaults        0 0

4. Backup and replace referencs in grub.conf
# cp -p /boot/grub/grub.conf /boot/grub/grub.conf.$(date +%F)
# grep old_vg_name /boot/grub/grub.conf
kernel /vmlinuz-2.6.32-642.1.1.el6.x86_64 ro root=/dev/mapper/old_vg_name-lv_root ... rd_LVM_LV=old_vg_name/lv_root ... rd_LVM_LV=old_vg_name/lv_swap ...

5. Backup and rebuild initramfs
# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
# dracut -f

6. Restart server
# reboot

No comments:

Post a Comment