วันอังคาร, มีนาคม 08, 2554

Shrink/Compress a VirtualBox Windows Guest Machine

Window guest image file (.vdi) eaten up the hard disk space. Check inside the Window guest; there're much of free spaces, didn't took so much of spaces as allocated on the host machines.
  So, I got bad mood!, my HDD's spaces was running out -_-" then I found this article "Shrink/Compress a VirtualBox Windows Guest Machine" (find the link at the bottom of the post)

  1. Open the window guest 
  2. Then use SDelete, small utility from MS themself.
    1. extract sdelete into windows directory
    2. open the command line terminal
    3. execute sdelete -c
    4. follow on-screen instruction
  3. close the VM
  4. use VBManage command to compact the vdi file
    1. VBoxManage modifyhd  .vdi --compact
  5. Hooray! :D

reference:
1 from http://r3dux.org/2010/10/how-to-shrinkcompress-a-virtualbox-windows-guest-machine/
2  VirtualBox help
  • With the --compact option, can be used to compact disk images, i.e. remove blocks that only contains zeroes. This will shrink a dynamically expanding image again; it will reduce the physical size of the image without affecting the logical size of the virtual disk. Compaction works both for base images and for diff images created as part of a snapshot. For this operation to be effective, it is required that free space in the guest system first be zeroed out using a suitable software tool. For Windows guests, you can use the sdelete tool provided by Microsoft. Execute sdelete -c in the guest to zero the free disk space before compressing the virtual disk image. Please note that compacting is currently only available for VDI images. A similar effect can be achieved by zeroing out free blocks and then cloning the disk to any other dynamically expanding format. You can use this workaround until compacting is also supported for disk formats other than VDI.

ไม่มีความคิดเห็น :