Pawan Sharma | May 13, 2012 | Be the first to comment!

Renaming Volume Group and Logical Volumes


In this post we will learn how to rename a logical volume or Volume group. Renaming Logical Volumes and Volume Groups is an important objective of RHCSA and RHCE certification exam. In the exam you would we asked to rename a LV or VG. This RHCSA/RHCE objective is not only important for the certification exam point of view but also for the real system administration environment. Many times in the production environment we need to rename the Logical Volume Groups and Logical Volume. So it is very important to learn how LVM and partitioning works in LINUX.

While renaming a  Logical Volume or Volume group it is important to take precautions as it may lead to data loss if you do something wrong. To rename a Logical Volume first we have to unmount the LV and then rename it using lvrename command. And to rename a Volume Group first we have to unmount all LVs in that VG and also deactivate all LVs (Under that VG) to use vgrename commang. Steps given below will explain the process more easily.

1. To rename a Logical Volume, first we have to unmount the LV using umount <mount_point>.
Renaming Logical Volume
2. Then rename the Logical Volume using lvrename command: 
lvrename <old_lvname> <new_lvname>  and then mount the LV using mount command and make changes to /etc/fstab.
Rename Volume Group in RHEL 6
 In the next example we will rename the Volume Group.
1. To rename the VG first unmount the mount all mount points in the VG:
 umount <mount_point>
2. And then deactivate the Volume Group to inactive all LVs in it. Using vgchange command.
vgchange -an <vg_name>
Renaming Logical Volume
3. Then rename the VG using vgrename command.
vgrename <vg_name>
4. After renaming the Volume Group use vgchange command to activate all LVs in VG.
vgchange -ay <vg_name>
Rename LogicalVolume
4. After activating all Logical Volumes mount the LVs and make changes to /etc/fstab to make changes persistent.

That’s how we can rename Logical Volume and Volume Group. In the next post we will see how to extend and reduce LVs online.

If you have any questions or quires add comments.

No comments:

Post a Comment