Operating System - HP-UX
1837111 Members
2221 Online
110112 Solutions
New Discussion

Re: Is it possible to move just one PE from one disk to another

 
nancy rippey
Trusted Contributor

Is it possible to move just one PE from one disk to another

I am currently using an unsupported 'vgmodify' command for HPUX 11.11 to to modify my vg information. This command allows you to change MaxPhyscialVolumes, MaxLogicalVolumes etc. In order for this to work the first PE on the disk must be free. I am able to free up the first PE with a pvmove of the lvol that is using the first PE. Then using vgmodify the first PE is used for the VGRA

My question is whether I can just move one PE (the first one, PE 00000) to another disk or if I must move the entire lvol.

Any help would be greated appreciated.

Nancy
nrip
8 REPLIES 8
Sridhar Bhaskarla
Honored Contributor

Re: Is it possible to move just one PE from one disk to another

Hi Nancy,

I cannot think of anything that will let you move just one PE. The possible command 'pvmove' can only move the entire LV on that PV to another PV.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Todd McDaniel_1
Honored Contributor

Re: Is it possible to move just one PE from one disk to another

Im not totally sure what you are trying to do.

Why you cant just pvcreate a new disk and move the data over?

VGRA header is created at disk creation time. Your other disk would already have this header info unless it is a new disk.

Or are you trying to overwrite the VGRA of the other disk?

A bit more info would be helpful.

Unix, the other white meat.
nancy rippey
Trusted Contributor

Re: Is it possible to move just one PE from one disk to another

The goal is to move previously created vgs to much larger EMC disk. The vgs were not created years ago to move to very large disk. For this to work the vg information must be changed. The only way to do this is to create another volume group and copy the data to it - but we came across this vgmodify command which does work but only if the first PE on a disk is free. This is so the VGRA can be written to it. If it was just a case of moving to a new disk a pvcreate would work great but I am also trying to modify the vg info - more phsy disks, lvs etc.
nrip
Todd McDaniel_1
Honored Contributor

Re: Is it possible to move just one PE from one disk to another

My personal choice is to do a dd copy OR mount new Lvols and execute a cp from the old lvol.

I think you might get into trouble using the vgmodify command.

We have done these types of moves and had little if any problem.


__________________________________________________________
You can try to do a mirror sync then break the mirror. THEN do your vgmodify to change the VGID and VGRA.

Your mirror disk is bigger so it wont matter... should work like a champ.

Of course you will have to change the Max extents and a few other things...
Unix, the other white meat.
Ashwani Kashyap
Honored Contributor

Re: Is it possible to move just one PE from one disk to another

Here is how I was able to modify the VGRA without losing data . But I think it is not supported and will not wotk in most cases . Do not try it on production .

Here is what I did on my C200 workststion running 11.11 .

Create a vg with defaults on one disk :
prithvi:/>pvcreate -f /dev/rdsk/c0t2d0
Physical volume "/dev/rdsk/c0t2d0" has been successfully created.
prithvi:/>mkdir /dev/vg01
prithvi:/>mknod /dev/vg01/group c 64 0x010000
prithvi:/>vgcreate /dev/vg01 /dev/dsk/c0t2d0
Increased the number of physical extents per physical volume to 2169.
Volume group "/dev/vg01" has been successfully created.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.cof
prithvi:/>vgdisplay /dev/vg01 | more
--- Volume groups ---
VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 0
Open LV 0
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 2169
VGDA 2
PE Size (Mbytes) 4
Total PE 2169
Alloc PE 0
Free PE 2169
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

Create 2 logical volumes of size 40 MB each and mount them .
prithvi:/>lvcreate -n lvol1 -l 10 /dev/vg01
Logical volume "/dev/vg01/lvol1" has been successfully created with
character device "/dev/vg01/rlvol1".
Logical volume "/dev/vg01/lvol1" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.cof
prithvi:/>lvcreate -n lvol2 -l 10 /dev/vg01
Logical volume "/dev/vg01/lvol2" has been successfully created with
character device "/dev/vg01/rlvol2".
Logical volume "/dev/vg01/lvol2" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.cof
prithvi:/>newfs -F vxfs /dev/vg01/rlvol1
version 4 layout
40960 sectors, 40960 blocks of size 1024, log size 1024 blocks
unlimited inodes, largefiles not supported
40960 data blocks, 39856 free data blocks
2 allocation units of 32768 blocks, 32768 data blocks
last allocation unit has 8192 data blocks
prithvi:/>newfs -F vxfs /dev/vg01/rlvol2
version 4 layout
40960 sectors, 40960 blocks of size 1024, log size 1024 blocks
unlimited inodes, largefiles not supported
40960 data blocks, 39856 free data blocks
2 allocation units of 32768 blocks, 32768 data blocks
last allocation unit has 8192 data blocks
Here is BDF .
/dev/vg01/lvol1 40960 1117 37360 3% /test1
/dev/vg01/lvol2 40960 1117 37360 3% /test2

Put some data in there .
prithvi:/>cp -p /etc/hosts /test1
prithvi:/>cp -p /stand/vmunix /test2
prithvi:/>ll /test1
total 2
-r--r--r-- 1 bin bin 616 Jan 20 10:08 hosts
drwxr-xr-x 2 root root 96 Jun 16 10:55 lost+found
prithvi:/>ll /test2
total 52478
drwxr-xr-x 2 root root 96 Jun 16 10:55 lost+found
-rwxr-xr-x 1 root sys 26868264 Nov 12 2003 vmunix

Now I remove this VG .
prithvi:/>umount /test1
prithvi:/>umount /test2
prithvi:/>vgchange -a n /dev/vg01
Volume group "/dev/vg01" has been successfully changed.
prithvi:/>vgexport /dev/vg01
prithvi:/>strings /etc/lvmtab
/dev/vg00
f0?q
/dev/dsk/c0t6d0

Now I recreate the VG with 50 PV and PE size of * MB on the same disk .
prithvi:/>pvcreate -f /dev/rdsk/c0t2d0
Physical volume "/dev/rdsk/c0t2d0" has been successfully created.
prithvi:/>mkdir /dev/vg01
prithvi:/>mknod /dev/vg01/group c 64 0x010000
prithvi:/>vgcreate -p 50 -s 8 /dev/vg01 /dev/dsk/c0t2d0
Increased the number of physical extents per physical volume to 1084.
Volume group "/dev/vg01" has been successfully created.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.cof

prithvi:/>vgdisplay /dev/vg01
--- Volume groups ---
VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 0
Open LV 0
Max PV 50
Cur PV 1
Act PV 1
Max PE per PV 1084
VGDA 2
PE Size (Mbytes) 8
Total PE 1084
Alloc PE 0
Free PE 1084
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

Now I recreate the LV . Note the number of LE's I use now .
prithvi:/>lvcreate -n lvol1 /dev/vg01
Logical volume "/dev/vg01/lvol1" has been successfully created with
character device "/dev/vg01/rlvol1".
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.cof
prithvi:/>lvcreate -n lvol2 /dev/vg01
Logical volume "/dev/vg01/lvol2" has been successfully created with
character device "/dev/vg01/rlvol2".
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.co

prithvi:/>lvextend -l 5 /dev/vg01/lvol1
Logical volume "/dev/vg01/lvol1" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.cof
prithvi:/>lvextend -l 5 /dev/vg01/lvol2
Logical volume "/dev/vg01/lvol2" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.cof
prithvi:/>

Now I mount them :
prithvi:/>mount /dev/vg01/lvol1 /test1
prithvi:/>mount /dev/vg01/lvol2 /test2
Here is BDF
/dev/vg01/lvol1 40960 1118 37359 3% /test1
/dev/vg01/lvol2 40960 27356 12761 68% /test2

And here are the contents :
prithvi:/>ll /test1
total 2
-r--r--r-- 1 bin bin 616 Jan 20 10:08 hosts
drwxr-xr-x 2 root root 96 Jun 16 10:55 lost+found
prithvi:/>ll /test2
total 52478
drwxr-xr-x 2 root root 96 Jun 16 10:55 lost+found
-rwxr-xr-x 1 root sys 26868264 Nov 12 2003 vmunix

And everything is back with new VG definitions .




Dietmar Konermann
Honored Contributor

Re: Is it possible to move just one PE from one disk to another

Ashwani,

please be careful with your approach. In your example the LVM header size didn't increase... so it's not suprising, that all worked fine.

hprtdu95[einstein]:/home/dkonerma$ lvmcompute -e 2169
*** Values used for calculation:
max_pe (-e): 2169
max_lv (-l): 255
max_pv (-p): 16
pe_size (MB, -s): 4

*** Calculated sizes:
vgda_len (maxlvs, maxpvs, maxpxs): 150 K
vgsa_len incl. padding (pvs, pxs): 10 K
mcr_len (const): 8 K
vgra_len (2*(vgda_len+vgsa_len+mcr_len)): 336 K

*** Conclusion for non-boot disks:
Start User Data (new: 64K aligned, min 1M): 1024 K
Start User Data (old: 64K aligned only): 512 K
336 K <= 4096 K, Combination OK.

*** Conclusion for boot disks:
Hypothetical Start of User Data: 2496 K
Effective Start of User Data (const): 2912 K
Combination OK.

*** Maximum resulting Storage Limits:
Total Size of Volume Group: 138816 M 136 G
Size of a single Physical Volume: 8676 M 8 G
Size of a single Logical Volume: 138816 M 136 G


hprtdu95[einstein]:/home/dkonerma$ lvmcompute -p 50 -s 8 -e 1084
*** Values used for calculation:
max_pe (-e): 1084
max_lv (-l): 255
max_pv (-p): 50
pe_size (MB, -s): 8

*** Calculated sizes:
vgda_len (maxlvs, maxpvs, maxpxs): 256 K
vgsa_len incl. padding (pvs, pxs): 8 K
mcr_len (const): 8 K
vgra_len (2*(vgda_len+vgsa_len+mcr_len)): 544 K

*** Conclusion for non-boot disks:
Start User Data (new: 64K aligned, min 1M): 1024 K
Start User Data (old: 64K aligned only): 704 K
544 K <= 8192 K, Combination OK.

*** Conclusion for boot disks:
Hypothetical Start of User Data: 2688 K
Effective Start of User Data (const): 2912 K
Combination OK.

*** Maximum resulting Storage Limits:
Total Size of Volume Group: 433600 M 423 G
Size of a single Physical Volume: 8672 M 8 G
Size of a single Logical Volume: 433600 M 423 G



As you can see, Start of User Data is 1024K in both cases (since 1024K is the minimum header size for recent LVM revisions).

Perform the same test with -p 100 instead of 50 (Header is 1072K then) and tell us the results. :)

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Ashwani Kashyap
Honored Contributor

Re: Is it possible to move just one PE from one disk to another

Dietmar ,

You are absolutely 100% correct about it .
As soon as the header crossed 1024 with 100 PV 's the LV's failed to mount until a newfs was done . But that destroys user data of course .

So a good lesson here and I knew it won't work in most cases , I just tried for the heck of it .

Thanks for telling us how the LVM header is made up .

Now one more thing , this lvmcompute utility , is this internal to HP or can we get it too . I couldn't find it on any of my systems .
Dietmar Konermann
Honored Contributor

Re: Is it possible to move just one PE from one disk to another

The lvmcompute tool is attached.

Have fun...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)