Rename a LVM Volume Group

Written by James McDonald

October 2, 2013

Steps I used to rename a volume group which had the root and swap partitions on it. This was on CentOS 6.4

# display your volume groups
# make note of the name you want 
# to change
vgdisplay

# check your options
vgrename --help

# backup your fstab
cp /etc/fstab /etc/fstab-20131002

# open your fstab
vi /etc/fstab

# run a vi find and replace command
:%s/vg_apfmapx01/vg_system/g

# perform the rename
vgrename vg_apfmapx01 vg_system

# change grub.conf
vi /boot/grub/grub.conf
%s/vg_apfmapx01/vg_system/g

# reboot
shutdown -r now

Problem: On reboot I got kernel panic – not synching (this was due to forgetting to replace the old volume group name in grub.conf with the new volume group name ).

Resolution: Reboot and edit the boot command line to make it correct and then edit grub.conf to make it correct and reboot

# replace the old name "vg_apfmapx01" with 
# the new volume group name "vg_system"
title CentOS (2.6.32-358.18.1.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-358.18.1.el6.x86_64 ro root=/dev/mapper/vg_system-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto rd_LVM_LV=vg_system/lv_swap rd_LVM_LV=vg_system/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        initrd /initramfs-2.6.32-358.18.1.el6.x86_64.img

 

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...