1752694 Members
5831 Online
108789 Solutions
New Discussion юеВ

Re: Change VG name

 
tayal_sumit
Occasional Advisor

Change VG name

Hi All,

I have a HP-UX server and only two hard disk is installed in the server and i have configured LVM on both the Hardisks. I want to change the name of the VG of my second harddisk.Whose VG name is VG01 and i want to rename it with VGAB and i have data on this harddisk would it be possible to change the name of the VG without any Data loss.If we can do it so please send me the steps.

regards,
8 REPLIES 8
Ramesh S
Esteemed Contributor

Re: Change VG name

Hi

Please follow these steps:

1)vgchange -a n vg01

3) vxexport -s -v -m /tmp/vg01.map vg01

4) mkdir /dev/VGAB

5) mknod /dev/VGAB/group c 64 0x010000

6) vgimport -v -m /tmp/vg01.map VGAB

7) vgcfgbackup VGAB

8) vgchange -a y VGAB

Hope this helps you!!

Thanks & Regards

Ramesh

Pete Randall
Outstanding Contributor

Re: Change VG name

Sure, just vgexport it, then vgimport it with the new name:

vgexport -s -m /tmp/vg01.map /dev/vg01
mkdir /dev/vgab
mknod /dev/vgab/group c 64 0x010000
vgimport -s -m /tmp/vg01map /dev/vgab

vgchange -a y /dev/vgab

I used 01 as the minor number, assuming it was used for vg01 and therefore should be available.


Pete

Pete
ASIFKHAN
Frequent Advisor

Re: Change VG name

Hello Tayal ,

In order to change the name of VG to VGAB without any data loss, you have to export and re-import it as follows:

1)First Umount all your logical volumes

#umount /dev/vg01/lvolxx
#umount /dev/vg01/lvolxx
. . .
#umount /dev/vg01/lvolxx


2) now deactivate the volume group vg01
#vgchange -a n vg01

3) now export your vg01 from system by #vxexport -s -v -m /tmp/vg01.map vg01

this will remove information of vg01 and its corresponding PV entries from file /etc/lvmtab.And -m option will make a mapfile(copy) having names of lvols that was present in VG01 and -s option will add an addtional line having VG-ID into the same map-file.
But keep remember that this -s option works only if u want to perform this task on the same system means if u want to export and import vg on the same system or over the sharable systems(in cluster environment)

4) #mkdir /dev/VGAB

5) #mknod /dev/VGAB/group c 64 0x010000

6) #vgimport -v -m /tmp/vg01.map VGAB

7) #vgcfgbackup VGAB

to save the lvm header information of new volume group VGAB into the lvm header backup file i.e. /etc/lvmconf/VGAB.conf

8) Now re-activate the VGAB
#vgchange -a y VGAB

Best Of luck
Thanks
Asif Khan
Steven E. Protter
Exalted Contributor

Re: Change VG name

Shalom,

While these operations are relatively safe, I'd do a backup before proceeding.

The minor number issue may result in headaches down the road, should you need to add fresh volume groups to this system.

Standard rename process or migration of shared disk from one system to another follows the vgexport/vgimport path.

This change appears to be somewhat cosmetic. There is a good reason to do it?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ralph Grothe
Honored Contributor

Re: Change VG name

While no comfort,
with Linux LVM all one would have to do was

# vgchange -an VG01
# vgrename VG01 VGAB
# vgchange -ay VGAB

and

# vi /etc/fstab

to correct the mounts
(which even wasn't necessary if labeled ext2/3 filesystems were used.

Wouldn't it be nice to have this feature also added to HP-UX LVM?
It can't be too complicated I would guess.
At least the penguin's LVM epigones have managed this ;-)
Madness, thy name is system administration
TwoProc
Honored Contributor

Re: Change VG name

Yeah Ralph,

I've noticed that I've come to love LVM on Linux. How come HP can't get a few more of the niceties of Linux LVM in the system? HP had this waaaay before Linux, why can't we get caught up a little on some of it?
We are the people our parents warned us about --Jimmy Buffett
Sp4admin
Trusted Contributor

Re: Change VG name

Look like the form has provided the answer. Just make sure when you do the "mknod" command you dont duplicate the hex number 0x010000.

sp,
tayal_sumit
Occasional Advisor

Re: Change VG name

Hi Ramesh,

I have not tried you r solution yet but it's seem to be perfect one.

Keep up the good work.

Thanks,
Sumit