• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • 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


    Deepak Prasad

    is a techie and an author who is still trying to survive in this IT generation with very little knowledge he has on Linux/Unix, VMware, SAN Storage, Automation, networking etc

    You can follow him on Facebook or Google+

    Do you also have something to share here?

    Join GoLinuxHub Team as an Author, Click here for more information
    How to rename Logical Volume and Volume Group in Linux How to rename Logical Volume and Volume Group in Linux Reviewed by Deepak Prasad on Monday, March 24, 2014 Rating: 5

    1 comment:

    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 :(

      ReplyDelete

    Powered by Blogger.