We had few of the servers which was similar in file systems, disk partitions, applications, etc .., but was exception in only Volume Group(VG). So I had cloned the systems and thought of renaming the VG, but since root Logical Volume(LV) was configured on the same VG was unable to un-mount online. I had to bring down the server to perform below steps.
Below has been performed on CentOS-6.3 32-bit kernel version - 2.6.32-279.el6
Since it is root volume, we need to umount the file system, insert the CentOS CD/DVD to boot server in rescue shell.
#boot: linux rescue
when it prompts for the questions, choose your answers.
Question 5 : Rescue window
Offers to mount Linux installation in rw, read only or not at all. Either way, we will be provided with a shell. As this system's root partition is on a logical volume in the volume group we wish to rename, we must not mount the system. [ SKIP ]
Make sure all your logical volumes are OFFLINE
# lvm lvscan
INACTIVE '/dev/vg_pcmk1/home' [1.00 GiB] inherit
INACTIVE '/dev/vg_pcmk1/rootvg' [13.18 GiB] inherit
INACTIVE '/dev/vg_pcmk1/swap' [1.46 GiB] inherit
#
#lvm vgscan
found volume group vg_pcmk1
.
.
(output omitted)
- Rename the volume group
#lvm rename vg_pcmk1 vg_pcmk2
- Exit the shell and reboot the server. Let CentOS DVD be in the disk.
#exit
- Reboot the server in the rescue environment and while in Question 5, choose Continue
Eventually, a shell will appear. The system files are in /mnt/sysimage. chroot into the system:
# chroot /mnt/sysimage
sh-4.1#vim /etc/fstab
- Change the entries of the volume group for the logical volumes which are residing.
# grep vg_pcmk2 /etc/fstab
/dev/mapper/vg_pcmk2-rootvg / ext4 defaults 1 1
/dev/mapper/vg_pcmk2-home /home ext4 defaults 1 2
/dev/mapper/vg_pcmk2-swap swap swap defaults 0 0
#
- Change an entry in grub.conf file.
#vim /boot/grub/grub.conf
# grep vg_pcmk2 /boot/grub/grub.conf
kernel /vmlinuz-2.6.32-279.el6.i686 ro root=/dev/mapper/vg_pcmk2-rootvg rd_LVM_LV=vg_pcmk2/rootvg rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rd_LVM_LV=vg_pcmk2/swap rhgb quiet
#
- Create a newly initrd image as below.
# tail -1 /boot/grub/grub.conf
initrd /initrd-2.6.32-279.el6.i686.img
#
As updated above, create new initrd image and this will take some time and will have no output.
#mkinitrd /boot/initrd-$(uname -r).img $(uname -r)
- Exit from shell:
# exit
- Exit from Linux rescue:
# exit
- Remove the CD and boot the server.
Once your server logins, check the VG name, it would be successfully changed.
# df -h | grep vg_pcmk2
/dev/mapper/vg_pcmk2-rootvg
/dev/mapper/vg_pcmk2-home
#
NOTE: If no proper entries in root volume being made, kernel gets PANIC and will not sync and kills init process.
No comments:
Post a Comment