How to rename Logical Volume and Volume Group in Linux

Rename a Logical Volume

NOTE: To rename a Logical Volume you will have to unmount your partition.

Syntax
# lvrename Volu_Group_Name  Old_log_vol_name new_log_vol_name
# lvrename VolGroup work office
 
Renamed "work" to "office" in volume group "VolGroup"
So now our Logical Volume is renamed.

In case your logical volume was mounted, you will have to remount to make the changes affect.
[root@test2 ~]# mount /dev/VolGroup/office /work/

Verify the changes
[root@test2 ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-root     11G  3.3G  7.0G  33% /
tmpfs                        495M   72K  495M   1% /dev/shm
/dev/sda1                    194M   30M  155M  16% /boot
/dev/mapper/VolGroup-office 1008M   34M  924M   4% /work

Rename Volume Group

The existing name for my Volume Group is VolGroup as you see in blue color. Let us try to rename it.

# vgdisplay
  --- Volume group ---
 
VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               14.80 GiB
  PE Size               4.00 MiB
  Total PE              3789
  Alloc PE / Size       3295 / 12.87 GiB
  Free  PE / Size       494 / 1.93 GiB
  VG UUID               iebYT7-Bukv-7FdP-AEMJ-noFk-INmV-7wX2PI
Syntax
# vgrename old_vol_group_name new_vol_group_name
# vgrename VolGroup NewGroup
 
Volume group "VolGroup" successfully renamed to "NewGroup"

Verify the changes
[root@test2 ~]# vgdisplay
  --- Volume group ---
 
VG Name               NewGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               14.80 GiB
  PE Size               4.00 MiB
  Total PE              3789
  Alloc PE / Size       3295 / 12.87 GiB
  Free  PE / Size       494 / 1.93 GiB
  VG UUID               iebYT7-Bukv-7FdP-AEMJ-noFk-INmV-7wX2PI

So everything worked as expected. Please let me know your success and failures.

Related Articles
How to extend/resize Logical Volume and Volume Group in Linux
How to remove logical and physical volume from Volume Group in Linux

2 thoughts on “How to rename Logical Volume and Volume Group in Linux”

  1. Team, please mention not to do this procedure for renaming a VG that have root partition on it. Beginners like me could easily fall in to kernel panic trap. I just fell 🙁

    Reply

Leave a Comment