La taille d'un VG sera réduite si on définit une nouvelle taille au Physical Volume:
sudo vgdisplay | grep Size
VG Size 119,05 GiB PE Size 4,00 MiB Alloc PE / Size 20616 / 80,53 GiB Free PE / Size 9861 / 38,52 GiB
sudo pvrezise --setphysicalvolumesize 40G /dev/sda1 sudo vgdisplay | grep Size
VG Size 39,15 GiB
fdisk /dev/sdb ## Delete all partitions with 'd' ## Create 2 new partitions (one with ~200Mb for Grub and all free space for the second) with 'n' pvcreate /dev/sdb2 vgcreate vg01 /dev/sdb2
MAX_SIZE=20G OLD_VG_NAME=vg00 for LV in $(ls -1 /dev/${OLD_VG_NAME}); do lvcreate --snapshot --name snap${LV} --size ${MAX_SIZE} /dev/${OLD_VG_NAME}/${LV} done
OLD_VG_NAME=vg00 TEMP_DIR=/mnt/tmp for LV in $(ls -1 /dev/${OLD_VG_NAME} | grep snap); do dd if=/dev/${OLD_VG_NAME}/${LV} of=${TEMP_DIR}/${LV}.img done
OLD_VG_NAME=vg00 NEW_VG_NAME=vg01 for LV in $(ls -1 /dev/${OLD_VG_NAME}|grep -v snap); do SIZE=$(lvs|\grep ${OLD_VG_NAME}|grep -v snap|grep ${LV}|sed 's/.* \([0-9]*,[0-9]*.\)/\1/g') lvcreate --name ${LV} --size ${SIZE} ${NEW_VG_NAME} done
NEW_VG_NAME=vg01 TEMP_DIR=/mnt/tmp for LV in $(ls -1 /dev/${NEW_VG_NAME}); do dd if=${TEMP_DIR}/${LV}.img of=/dev/${NEW_VG_NAME}/${LV} done