From Wiki-UX.info

Wiki-UX / Logical Volume Manager / How to change the name of a volume group
Jump to: navigation, search

How to change the name of a volume group

Abstract

This articles explains how to change the name of a LVM volume group. The method describe consist in export and import back the volume group with the using the new name with the vgexport and vgimport commands.

Using this commands ensures that the LVM configuration files and the kernel status is updated cleanly with the new volume group name.

Contents


Procedure

The following procedure shows how to change the LVM volume group "vg01" to "vgbackup".

1. Check the current volume group special device files minor and major numbers and identified the disk(s) that belongs to the volume group.

# ll /dev/vg01/*
crw-r-----   1 root       sys         64 0x010000 Oct 11 10:37 /dev/vg01/group
brw-r-----   1 root       sys         64 0x010001 Oct 11 10:45 /dev/vg01/lvol1
crw-r-----   1 root       sys         64 0x010001 Oct 11 10:45 /dev/vg01/rlvol1

# vgdisplay -v /dev/vg01 | grep "PV Name" | awk '{print $3}'
/dev/disk/disk8

or

# strings /etc/lvmconf/vg01.conf | grep "/dev"
/dev/vg01
/dev/rdisk/disk8

2. Unmount the filesystem. You need to stop any active process on the logical volume.

# umount /dev/vg01/lvol1

3. Export the volume group in share mode creating a map file. If you are using mapfiles instead

# vgchange -a n /dev/vg01
Volume group "/dev/vg01" has been successfully changed.

# vgexport -s -m /tmp/vg01.mapfile /dev/vg01
vgexport: Volume group "/dev/vg01" has been successfully removed.

4. Create the new volume group name directory and group device special file.

# mkdir /dev/vgbackup

# mknod /dev/vgbackup/group c 64 0x010000

5. Import backup the volume group configuration

# vgimport -m /tmp/vg01.mapfile /dev/vgbackup  /dev/disk/disk8
vgimport: Volume group "/dev/vgbackup" has been successfully created.
Warning: A backup of this volume group may not exist on this machine.
Please remember to take a backup using the vgcfgbackup command after activating the volume group.

# vgchange -a y /dev/vgbackup
Activated volume group
Volume group "/dev/vgbackup" has been successfully changed.

# vgcfgbackup /dev/vgbackup
Volume Group configuration for /dev/vgbackup has been saved in /etc/lvmconf/vgbackup.conf

Edit the corresponding entries in /etc/fstab to point to the new volume group paths.

Change the logical volumes names

If you need to change the names of the logical volume, edit the map file and change the logical volume name(s) as required. The vgimport will create the device special files with the new names.

Reference

Authors

This page was last modified on 3 August 2011, at 18:54. This page has been accessed 2,683 times.