Renaming logical volume group and volumes

Hi all,

How do u rename a logical volume group and the logical volumes belonging to that? The logical volumes contain data and are in use.

eg: Renaming dev/vgov to dev/ov-dg ?

The easiest would be an export / import of the VG...(man vgexport/vgimport...)

This should rename the lvols. Once you do that then you can use vgexport and rename the VG's with a map file. Best to try this on a test VG first.

  1. umount /<oldname>
  2. mv /dev/vgxx/<oldname> /dev/vgxx/<newname>
    mv /dev/vgxx/r<oldname> /dev/vgxx/r<newname>
  3. Modify the /etc/fstab file to reflect the newname.
  4. mount /dev/vgxx/<newname> /<oldname>
    or
    mount -a
    NOTE: if you would also like to change the mount point to <newname>
    do the following before step 3 above:
    mkdir <newname>
    rmdir <oldname>
    Then modify step 3 and 4 above to reflect the newname

Can i rename the group first and then the lvols?

I don't see any reason why not. Do it on a test VG before you try it on a production one.

Well yes you can!!! Follow the below and that's it to change vg and lv as well..

Export the VG:

  1. # umount /oldmountpoint
  2. # vgchange �a n vgname
  3. # vgexport �s �v �m /etc/lvmconf/vgname.map vgname

Rename the VG directory, edit LV names, and re-import:

  1. # mkdir /dev/newvgname
  2. # mknod /dev/newvgname/group c 64 0x010000 (Minor number example. Please ensure that it's unique)
  3. # cp /etc/lvmconf/vgname.map /etc/lvmconf/newvgname.map
    =>If you want to change your logical volume names, simply use the vi editor to modify the names in the map file.
  4. # vi /etc/lvmconf/newvgname.map
    VGID 0a0a0a0a0
    1 newlvname
  5. # vgimport �s �v �m /etc/lvmconf/newvgname.map newvgname
  6. # vgchange �a y newvgname
  7. # vgcfgbackup newvgname
  8. # mv /oldmountpoint /newmountpoint
  9. # vi /etc/fstab => add entry
  10. # mount -a

-You're done!

Please let us know if you find any issues!

-DB

THanks,

Did exactly as u mentioned-

First renamed the lvols,using umount, mv and then modified /etc/fstab, then mount -a

THen modified the group as explained.

:slight_smile: