How to Shrink VirtualBox VM of WinXP

Scenario:

When using VirtualBox, the size of VM expands over time. In case of running out of hard disk space, I would like to shrink the VM to free up unused space.

Environment:

VirtualBox 3.2.12

VM Guest: WinXP

Process:

Step 1. Open VM Guest and perform a hard disk defragmentation (Disk Defragmenter).

Step 2. Execute SDelete to zero the free space.

sdelete -z

Although the VirtualBox manual says that use sdelete -c to zero the free space, I found that execute sdelete -z is better. (When using -c, the size of VM increased dramatically, don’t know why…)

Step 3. Shutdown VM and back to the Host machine.

Step 4. Execute

VBoxManage modifyhd [vm filename.vdi] –compact

• The vm filename could be the base images or snapshots.

• Currently this command only supports VDI format.

Step 5. Done.

How to convert VirtualBox VMDK to VDI

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s