pv-fixup: more metadata, align PEs, and tweaks
authorGreg Price <price@mit.edu>
Wed, 25 Mar 2009 03:58:19 +0000 (23:58 -0400)
committerGreg Price <price@mit.edu>
Wed, 25 Mar 2009 03:58:19 +0000 (23:58 -0400)
svn path=/trunk/scripts/pv-fixup/; revision=2272

pv-fixup

index abcb494..d5c0830 100644 (file)
--- a/pv-fixup
+++ b/pv-fixup
@@ -8,7 +8,7 @@ TMPDM=tmpfoo
 TMPDEV=/dev/mapper/$TMPDM
 TMPDM2=tmpbar
 TMPDEV2=/dev/mapper/$TMPDM2
 TMPDEV=/dev/mapper/$TMPDM
 TMPDM2=tmpbar
 TMPDEV2=/dev/mapper/$TMPDM2
-METADATASIZE=3.5m
+METADATASIZE=8128k
 
 #  - pvresize the old PV to half the space
 pvresize --setphysicalvolumesize=${HALFSIZETiB}t $DISK
 
 #  - pvresize the old PV to half the space
 pvresize --setphysicalvolumesize=${HALFSIZETiB}t $DISK
@@ -92,18 +92,18 @@ done
 
 
 #  - pvremove the old PV
 
 
 #  - pvremove the old PV
-vgreduce $VG $DISK
-pvremove $DISK
+LVM_SYSTEM_DIR=lvm vgreduce $VG $DISK
+dmsetup create $TMPDM2 --table "0 $((2 * 1024 * 20)) linear $DISK 0"
+pvremove $TMPDEV2
 
 #  - pvcreate a new PV in the old space,
 #     with --setphysicalvolumesize <half size>
 #     and with --metadatasize <huge>    (the point of this exercise)
 shortsize=$(python -c "print $HALFSIZETiB - 0.01")t
 
 #  - pvcreate a new PV in the old space,
 #     with --setphysicalvolumesize <half size>
 #     and with --metadatasize <huge>    (the point of this exercise)
 shortsize=$(python -c "print $HALFSIZETiB - 0.01")t
-dmsetup create $TMPDM2 --table "0 $((2 * 1024 * 4)) linear $DISK 0"
 pvcreate $TMPDEV2 --setphysicalvolumesize $shortsize --metadatasize $METADATASIZE
 dmsetup remove $TMPDM2
 pvscan
 pvcreate $TMPDEV2 --setphysicalvolumesize $shortsize --metadatasize $METADATASIZE
 dmsetup remove $TMPDM2
 pvscan
-vgextend $VG $DISK
+LVM_SYSTEM_DIR=lvm vgextend $VG $DISK
 
 #  - pvmove all the LVs back
 
 
 #  - pvmove all the LVs back