Virtualbox compression vdi hard drive

Source: Internet
Author: User


After the virtualbox compression vdi hard disk was cleaned up by the guest system today, we found that we should compress the virtual hard disk and find it on the Internet. All of them use the vboxmanage tool. However, if we do this, it will be unsuccessful. Finally, I found the official document to find out the cause. First, read the official vbox documentation: http://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvdi VBoxManage modifyhd <uuid> | <filename> [-- type normal | writethrough | immutable | retriable | readonly | multiattach] [-- autoreset on | off] [-- compact] [-- resize <megabytes> | -- resizebyte <bytes>] With the -- compact option, can be used to compact disk images, I. e. remove blocks that only contains zeroes. this will shrink a dynamically allocated image again; it will reduce the physical size of the image Affecting the logical size of the virtual disk. compaction works both for base images and for diff images created as part of a snapshot. www.2cto.com For this operation to be valid, 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-z in the guest to zer O the free disk space before compressing the virtual disk image. for Linux, use the zerofree utility which supports ext2/ext3 filesystems. 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 allocated format. you can use this workaround until compacting is also supporte D for disk formats other than VDI. The key point is that sdelete should use the-z option, and the online method is to use the-c option, which wastes nearly three hours. MS documentation also understands: http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx Using SDeleteSDelete is a command line utility that takes a number of options. in any given use, it allows you to delete one or more files and/or directories, or to cleanse the free space on a logical disk. SDelete accepts wild card characters as part of the directory or file specifier. www.2cto.com usage: sdelete [-p passes] [-s] [-q] <file or directory>... sdelete [-p passes] [-z |-c] [drive letter]... -a Remove Read-Only attribute-c Clean free space-p passes Specifies number of overwrite passes (default is 1)-q Don't print errors (Quiet) -s or-r Recurse subdirectories-z Zero free space (good for virtual disk optimization) So, to sum up, the correct method should be as follows: 1. Clean the system in guest OS, for windows, try hard disk fragmentation. 2. Use sdelete-z in guest OS. For linux, use zerofree3 and VBoxManage modifyhd <uuid >|< filename> -- compact author bbplayers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.