• 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.

  • Life always offers you a second chance ... Its called tomorrow !!!

    Monday, March 24, 2014

    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


    Follow the below links for more tutorials

    Configure Red Hat Cluster using VMware, Quorum Disk, GFS2, Openfiler
    Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
    Step by Step Linux Boot Process Explained In Detail
    What is the difference between ext3 and ext4 filesystem in Linux ?
    How to secure Apache web server in Linux using password (.htaccess)
    How to register Red Hat Linux with RHN (Red Hat Network )
    Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
    15 tips to enhance security of your Linux machine
    Why is Linux more secure than windows and any other OS
    What is the difference between "su" and "su -" in Linux?
    What is kernel-PAE in Linux?
    What is swappiness and how do we change its value?
    How to log iptables messages in different log file
    What are the s and k scripts in the etc rcx.d directories
    How to check all the currently running services in Linux
    How to auto start service after reboot in Linux
    What is virtual memory, paging and swap space?

    1 comments:

    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