Shrink lvm partition in VMware

Shrink lvm partition in VMware

  1. Back-up the VM ; this is way you have a VM so you can clone it easily or using a back-up tool
  2. Remove the connected interfaces and test your back-up ; you never know
  3. Boot from live CD ( since most of the operation that need to be done you need not to have mounted volumes)
  4. Discover volumes : vgchange -a y
  5. Make sure that volumes are error free: e2fsck -fy /dev/vol_ group/logical_volume
  6. Know your stuff 1: vgdisplay and lvdisplay
  7. Know your stuff 2: mount/umount volume and check free space, mount /dev/vg01/rootfs /mnt/gentoo ;  df -h ; umount /mnt/gentoo
  8. Before going to next step: actual data < file system <= logic volume
  9. resize2fs /dev/vg01/rootfs 30G
  10. lvreduce -L 31G /dev/vg01/rootfs
  11. Theoretically you have done with Linux part ; better test it -> either mount or reboot
  12. 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


Leave a Reply

Your email address will not be published. Required fields are marked *