From 97d56e5f05cdc42d9ac1e8a190a6aa9c18a769a5 Mon Sep 17 00:00:00 2001
From: Greg Price <price@mit.edu>
Date: Tue, 24 Mar 2009 23:58:19 -0400
Subject: [PATCH] pv-fixup: more metadata, align PEs, and tweaks

svn path=/trunk/scripts/pv-fixup/; revision=2272
---
 pv-fixup |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pv-fixup b/pv-fixup
index abcb494..d5c0830 100644
--- a/pv-fixup
+++ b/pv-fixup
@@ -8,7 +8,7 @@ TMPDM=tmpfoo
 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
@@ -92,18 +92,18 @@ done
 
 
 #  - 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
-dmsetup create $TMPDM2 --table "0 $((2 * 1024 * 4)) linear $DISK 0"
 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
 
-- 
1.7.9.5