[Note] How to Compact VitualBox's HardDisk File (. vdi)

Source: Internet
Author: User
Tags compact

If guest OS is Windows, use system defrag tools first, and then goto step 5.

If guest OS is Linux, like Ubuntu for example, follow these steps:

 

1. Download zerofree file from the url below and install it, need gcc libraries and ext2fs library if compile it from source.

Wget http://intgat.tigress.co.uk/rmy/uml/zerofree-1.0.1.tgz or sudo apt-get install zerofree

 

2. Start runlevel 1

Sudo telinit 1

 

3. check to see disk names using df command and in left corner of the result there are/dev /... devices, in my case/dev/sda1. Mount this disk as read only:

Mount-n-o remount, ro-t ext3/dev/sda1/

 

4. Make zeros and Check if everything is OK with file system

Zerofree/dev/sda1
Fsck-f/dev/sda1

 

5. shutdown guest OS.

 

6. use VBoxManage to shrink the space

"C: \ Program Files \ Sun \ VirtualBox \ VBoxManage" modifyvdi vdi_file_name.vdi compact

 

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.