linux - Why Disk image file on host computer doesn't decrease when I delete huge files in virtual machine? -
i installed centos on virtualbox(host os windows 7). created disk image file vdi files(dynamically allocated image). recently,when delete huge files in centos,the vdi file on disk doesn't decrease. why? how tackle problem?
virtualbox not automatically reclaim disk space (on host) when delete files within vm. shrink disk image, need to
first, 0 out free spaces (for partitions , logical volumes on hdd) , turn vm off.
cat /dev/zero > z;sync;sleep 3;sync;rm -f z
then, utilize next command compact vdi.
vboxmanage modifyhd /path/to/image.vdi --compact
vbox doc
with --compact option, can used compact disk images, i.e. remove blocks contains zeroes. shrink dynamically allocated image again; cut down physical size of image without affecting logical size of virtual disk. compaction works both base of operations images , diff images created part of snapshot.
btw: vmware (.vmdk), need utilize vmware-vdiskmanager -k xxx.vmdk
same.
linux virtualbox
No comments:
Post a Comment