Operating System - HP-UX
1826444 Members
3935 Online
109692 Solutions
New Discussion

Change Name of Logical Volumes

 
SOLVED
Go to solution
Herbert Loevenich
Frequent Advisor

Change Name of Logical Volumes

Dear Comminity,

after the root disk crash, without be able to restore anything, i was be able to "active" the logical volumes on three other disk using:

1. Create the volume group and the group file on the running system
# mkdir /dev/vgXX
# cd /dev/vgXX
# mknod /dev/vgXX/group c 64 0xXX0000 !! XX = volume group number !!

2. Import the disk !! logical volume names ARE different !!
# vgimport -v /dev/vgXX /dev/dsk/c.t.d0

3. Activate the new volume group
# vgchange -a y /dev/vgXX


Unfortunately the "RAW" logical volume names are now differnt, just lvol1 lovl2.

The orginal names are more meaning full
like table and index.

Is there any way to rename the logical volume name ?

Thanks and best regards,

Herbert
50% of all problems are based on communication issues, lets talk
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor

Re: Change Name of Logical Volumes

Yes, it's simple.

1) vgexport -p -m /tmp/vgxx.map /dev/vgxx
this will create a mapfile, /tmp/vgxx.map. Edit this file and name the LVOL's as you like. Note the -p option which will not actually export the VG.

2) Unmount the filesystems, deactivate the vg, and then do the vgexport w/o -p and -m options.

3) Recreate your /dev/vgxx directory and your /dev/vgxx/group file.

4) vgimport -m /tmp/vgxx.map -v /dev/vgxx /dev/dsk/cxtyd0 ... any other disks

5) vgcxhange -a y /dev/vgxx

6) alter /etc/fstab to reflect your changed LVOL names

7) mount the filesystems
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: Change Name of Logical Volumes

and obviously if any of your LVOL's are used as simply raw device then ignore the unmount/mount filesystem or edit /etc/fstab steps for these LVOL's.
If it ain't broke, I can fix that.
Chan 007
Honored Contributor

Re: Change Name of Logical Volumes

I agree with Clay, but mount/unmount is not required for RAW devs.
Herbert Loevenich
Frequent Advisor

Re: Change Name of Logical Volumes

Yes you are right we are talking about raw devices.

Unfortunately the first command came already back with the devices are still active.

50% of all problems are based on communication issues, lets talk
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Change Name of Logical Volumes

That's perfectly normal. All we want to do is create the mapfile that you will edit and the mapfile will be created even with the warning that you see.
If it ain't broke, I can fix that.
Herbert Loevenich
Frequent Advisor

Re: Change Name of Logical Volumes

thank you

It works, i was a bit irritated by the error message. But now it's time to go to bed. 00:30 local time.

Herbert
50% of all problems are based on communication issues, lets talk
Bill Hassell
Honored Contributor

Re: Change Name of Logical Volumes

If you know what the correct names are, the solution is trivial. No mapfiles or any LVM manipulation is needed. Just use mv to rename the lvols (and remember the rlvols too). Unlike volume groups, the lvol names can be changed easily with just mv as in:

mv /dev/vgxx/lvol1 /dev/vgxx/index
mv /dev/vgxx/rlvol1 /dev/vgxx/rindex

Since these are raw data volumes, there is nothing else to do. For most raw volumes, you can often 'read' a few bytes at the beginning of the disk as in:

xd -xc /dev/vgxx/rlvol1 | head -20

This can help identify the lvol. Butg the order of the lvols (1,2,3,...) is exactly the same as the previous names so just rename them in the same order.


Bill Hassell, sysadmin