[vbox-dev] reduce the size of vdi file

Klaus Espenlaub klaus.espenlaub at oracle.com
Thu Mar 21 07:16:50 PDT 2013

On 21.03.2013 10:38, Rajiv Jaisankar wrote:
> Hi,
> I am using Virtualbox 4.1.18. Virtualbox installed in windows7 64-bit,
> vm running in linux 64-bit. One of my VM’s VDI file has grown really
> big. Inside the vm, (in the linux machine) Ihave used only 10GB. But the
> VDI is 20GB. I have never used snapshots for this VM. Is there any way
> to reduce the size of vdi file? Can I run sdelete on the VDI file?
> (http://technet.microsoft.com/en-us/sysinternals/bb897443)  (or) use
> http://www.feyrer.de/g4u/nullfile-1.02.exe (or)  use VBoxManage modifyhd
> –compact option?

Read the VirtualBox manual, it tells you what to do. Help -> Contents, 
http://www.virtualbox.org/manual/UserManual.html, ...

> I tried the third option in my env. Was getting below error executing
> modifyhd –compact. All vms are created as the same user. Should I run
> this command as Administrator user?


> C:\Users\rajivj>VBoxManage modifyhd "C:\users\rajivj\VirtualBox
> VMs\server1" –compact

The command expects to get a disk image filename, and you point to the 
VM directory. Can't work.

> VBoxManage.exe: error: Permission problem accessing the file for the
> medium 'C:\
> users\rajivj\VirtualBox VMs\server1' (VERR_ACCESS_DENIED)

... and that's the OS way of telling you that you're trying to do 
something which won't work.

Get the command line right and read the corresponding section in the 
manual (otherwise you'll just end with an image of the same size).


> VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004),
> component M
> edium, interface IMedium, callee IUnknown
> Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType,
> AccessMode_ReadW
> rite, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 210 of file
> VBoxManage
> Disk.cpp
> Thanks,
> Rajiv

More information about the vbox-dev mailing list