1833861 Members
2383 Online
110063 Solutions
New Discussion

Rename a vg

 
Sridhar R
Regular Advisor

Rename a vg

Hi,

I want to rename a volume group.

I believe i have to use vgimport and vgexport commands to achieve this!

Only one lvol reside in this VG, which doesn't have any data.

Can anyone provide me the syntax for renaming?

Say for example, renaming vg04 to vg05.

And do i need to do any vgcfgbackup for this?

Thanks in Advance!

Sridhar

7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: Rename a vg

You believe right: vgexport/vgimport.

vgchange -a n /dev/vg04
vgexport -s -m /tmp/vg04map /dev/vg04
mkdir /dev/vg05
mknod /dev/vg05/group c 64 0x050000
vgimport -s -m /tmp/vg05map /dev/vg05
vgchange -a y /dev/vg05

Note that map files are required only if you have non-standard lvol names (lvol1, lvol2, etc). Also note, that I suggest using the -s option so you don't have to identify the individual device paths.


Pete

Pete
Siju Vadakkan
Trusted Contributor

Re: Rename a vg

1. create the map file and remove the old vg with the below command.
#vgexport -v -s -m /tmp/vg04.map vg04
2. Create the new directory, group file and then import the old disk group structure for the new VG.
#mkdir /dev/vg05
#mknod /dev/vg05/group c 64 0x050000
#vgimport -v -s -m /tmp/vg04.map vg05
Pete Randall
Outstanding Contributor

Re: Rename a vg

Oops, I used the wrong map file name in my import - make that "vg04map".


Pete

Pete
Robert-Jan Goossens
Honored Contributor

Re: Rename a vg

Hi Sridhar,

Hmmm...
--
Only one lvol reside in this VG, which doesn't have any data.
--

In that case, blow away your vg and create a new one.

# umount "lvol"
# vgchange -a n vgxx
# vgexport vgxx
# mkdir /dev/vgxx
# mknod /dev/vgxx/group c 64 0x0Z0000
change Z in a free number.
# pvcreate -f /dev/rdsk/cxtydz
# vgcreate /dev/vgxx /dev/dsk/cxtydz
You can additional parameters for larger disks if you like.

Regards,
Robert-Jan
AVV
Super Advisor

Re: Rename a vg

Follow the simple steps which I believe,

1.Deactivate vg #vgchange -a n /dev/vg04
2.Export vg and get a map file #vgexport -s -m /tmp/vg05.map vg04
3.create dir named with new vg #mkdir /dev/vg05
4.create device file for the same #mknod /dev/vg05/group c 64 0xXX0000 - XX should be unique
5.vgimport #vgimport -s -m /tmp/vg05.map /dev/vg05
6.vgactivate# vgchange -a y /dev/vg05

-s optin is using to get the vgid along with the map file. Thanks -ajeshvv


vjta
Regular Advisor

Re: Rename a vg

Hi Sri!

As u told data is not there so its very simple
u just go for new vg creation by removing old .
like ------>
# umount "lvol"
# vgchange -a n vg04
# vgexport vg04
# mkdir /dev/vg05
#ll /dev/*/group -----> for checking in our case assumin 5 for vg05
# mknod /dev/vg05/group c 64 0x050000
# pvcreate -f /dev/rdsk/cxtydz
# vgcreate /dev/vg05 /dev/dsk/cxtydz



regards
Vjta
Vijeta Bhedi
Jeeshan
Honored Contributor

Re: Rename a vg

Hi Sridhar

In order to rename a VG you have to export and re-import it:
# umount /dev/vg01/lvol1
# umount /dev/vg01/lvol2
...

# vgchange -a n vg01
# vgexport -m /tmp/mapfile vg01
# ll /dev/*/group (choose a unique minor no.)
# mkdir /dev/vgnew
# mknod /dev/vgnew/group c 64 0x010000
# vgimport -m /tmp/mapfile vgnew /dev/dsk/c4t0d0 /dev/dsk/c5t0d0 ...
a warrior never quits