您的位置:首页 > 其它

[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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: