[Note]How to Compact VitualBox's HardDisk File(.vdi)
2010-03-12 13:37
417 查看
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
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
相关文章推荐
- How to mount encrypted linux disk/diskIMGfile
- how to copy a virtualbox vdi
- How To: Convert VirtualPC .vhd hard drives to VirtualBox .vdi hard drives (or vice-versa)
- How to convert VirtualBox vdi to KVM qcow2
- This tip shows how to extract the width and height from a bitmap source file on disk.
- How to Use Disk Utility to Erase a Macintosh Hard Drive
- 重建ocr(recreate ocr)mos文章NOTE:399482.1- How to Recreate OCR/Voting Disk Accidentally Deleted
- How to Customize Common Open File Dialog Box Places Bar in Windows
- Tip:How to Compact a PST File to Reduce Its Size in Outlook
- How to remove the copyright box on a paper that uses the ACM sig-alternate.cls class file?
- How to get file name on disk (sting thing on any OS)?
- How to download Bing maps to your hard disk
- how to show a dialog box that prompts you to either "Open it" or "Save it to disk"again?
- How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)
- File Uploading to Server Hard Disk using ASP.NET
- How to Configure Hard Disk Drives on a CEPC
- How to build mex file directly in Visual Studio 2010?
- 【Ant】How to print all the system properties in Ant build file
- How to make Universal Static library (.a file) in iOs using xCode
- How to deploy Maven based war file to Tomcat