Shrink VBox image

To shrink/compact VirtualBox image:

Was .vmdk and compact only works on .vdi.

Clone the image and format to .vdi:

First created another partition with enough space then cloned and formatted:

/usr/lib/virtualbox/VBoxManage clonehd /media/winXpVM/tcollinsworth-lt/tcollinsworth-lt.vmdk /media/winXpVM2/tcollinsworth-lt/tcollinsworth-lt.vdi  --format VDI

Added the disk to VM in VirtualBox Manager and removed the old one. Only change was to switch the disk to primary master.

To convert .img to .vdi:
  • VBoxManage convertdd  winXP.img winXP.vdi
Started the OS and cleaned it up disk:
  • downloads
  • temp files
  • trash
  • restore points
  • etc.
Zeroed unused disk blocks with: 

sdelete -z

Shutdown OS

Compact the .vdi

/usr/lib/virtualbox/VBoxManage modifyhd /media/winXpVM2/tcollinsworth-lt/tcollinsworth-lt.vdi --compact

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout

Locks held on Oracle for hours after sessions abnormally terminated by node failure