Shrink lvm partition in VMware
- Back-up the VM ; this is way you have a VM so you can clone it easily or using a back-up tool
- Remove the connected interfaces and test your back-up ; you never know
- Boot from live CD ( since most of the operation that need to be done you need not to have mounted volumes)
- Discover volumes : vgchange -a y
- Make sure that volumes are error free: e2fsck -fy /dev/vol_ group/logical_volume
- Know your stuff 1: vgdisplay and lvdisplay
- Know your stuff 2: mount/umount volume and check free space, mount /dev/vg01/rootfs /mnt/gentoo ; df -h ; umount /mnt/gentoo
- Before going to next step: actual data < file system <= logic volume
- resize2fs /dev/vg01/rootfs 30G
- lvreduce -L 31G /dev/vg01/rootfs
- Theoretically you have done with Linux part ; better test it -> either mount or reboot
- Now you can do a vmotion or clone using thick provisioning.
PS: In case you need to add the space to other LVS:
- a) lvextend -l +100%FREE /dev/vg01/testlv – to use all the space
- aa) lvextend -L+1G /dev/vg01/testlv – to add 1G to existing space
- b) resize2fs /dev/vg01/testlv