Red Hat Rename VolGroup00
id : 6xokaah6as
category : computer
blog : unixlinux
created : 02/28/11 - 10:45:50

  • Halt your system, find a live cd and boot on it. Be carefull, your live must have lvm2
  • Discover pv, vg and lv
# pvscan
# vgscan 
# lvscan

  • VolGroup00 has to be desactivate before any action
# vgchange -an VolGroup00

  • Rename it :
# vgrename /dev/VolgGroup00 rootvg

  • VolGroup00 is now known as rootvg
  • Mount all lv, and your /boot partitions
  • Modify your fstab :
# sed -i 's/VolGroup00/rootvg/g' /mntslash/etc/fstab

  • Same thing with your grub.conf :
# sed -i 's/VolGroup00/rootvg/g' /mntboot/grub/grub.conf

  • Remove lvm cache :
# rm /etc/lvm/.cache

  • Here is the tricky part :
    • In your /boot partition, create a new directory :
# cd /mntboot
# mkdir newinit

    • Unpack system initrd
# cd newinit
# gunzip -c ../initrd-2.6.18-194.el5.img | cpio -idmv

    • Find all instance of VolGroup00 in init file, and change them to rootvg
# sed -i 's/VolGroup00/rootvg' ./init

    • Repackage up a new image :
# find . | cpio --quiet -c -o > ../newinitrd
# cd ..
# gzip -9 < newinitrd > initrd-2.6.18-194.el5.img

    • Sync and umount /boot :
# sync
# umount /mntboot
# umount /mntslash
# sync

  • Then reboot :
# shutdown -Fr now

  • Be carefull if you rename lv in your VolGroup00 vg, init file contains references to / and to swap, replace it with names of your new lv.