• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL 6 : How to Change the Volume Group Name for Root Disk Device

by admin

The post describes the renaming of the volume group (vg) being used for the root file system. For example purpose we will be renaming the disk group from vg_old to vg_new.

Steps

1. Rename the Volume Group from vg_old to vg_new :

# vgs
  VG         #PV #LV #SN Attr   VSize VFree
  vg_old   1   2   0 wz--n- 7.88G    0
# vgrename  vg_old vg_new
  Volume group "vg_old" successfully renamed to "vg_new"
# vgs
  VG            #PV #LV #SN Attr   VSize VFree
  vg_new   1   2   0 wz--n- 7.88G    0

2. Replace references to the old VG name ( vg_old ) with the new VG name ( vg_new ) in the files /etc/fstab and /boot/grub/grub.conf. I have changed the 2 references (for swap and root filesystem) with the new disk group name vg_new (highlighted).

# cat /etc/fstab
/dev/mapper/vg_new-lv_root    /                       ext4    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/mapper/vg_new-lv_swap    swap                    swap    defaults        0 0

Similarly do the changes in /boot/grub/grub.conf :

# cat /boot/grub/grub.conf
...
	kernel /vmlinuz-2.6.32-642.1.1.el6.x86_64 ro root=/dev/mapper/vg_new-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_new/lv_root rd_NO_MD rd_LVM_LV=vg_new/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
...

3. Create a New Ramdisk Image:
Run the following commands to make a new initial ramdisk image. It is recommended you make a backup copy of the initrd in case the new version has an unexpected problem:

# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

Now rebuild the initramfs for the current kernel version:

# dracut -f

4. Reboot the server.

# shutdown -r now

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to Configure Password Expiration and Complexity Requirements in CentOS/RHEL
  2. “comm” Command in Linux with Examples
  3. How to Connect Remote Host Using the ssh Command
  4. 5 Useful Command Examples to Monitor User Activity under Linux
  5. How to Reset Root Password in CentOS/RHEL 8
  6. Bash for loop Examples
  7. Error: Can’t open display: hostname:x.y when running xclock
  8. How to gzip all or specific files in Linux
  9. How to Configure Early-kdump Support Feature in CentOS/RHEL 8
  10. CentOS / RHEL 7 : How to recover from deleted root entry in /etc/shadow and/or /etc/passwd files

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright