Compacting Medium VDI
Compacting Medium VDI
Hi,
I have a Windows guest Win 7 x64 in a VDI, it has gotten to a size that I would like to compact it as my linux host Ubuntu 16.04 LTS only has a small SSD.
I have removed any large files in the guest, defragged and ran sdelete. However when I try to compact the VDI I get the following error.0%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage: error: Failed to compact medium
VBoxManage: error: Code VBOX_E_FILE_ERROR (0x80BB0004) - File not accessible or erroneous file contents (extended info not available)
VBoxManage: error: Context: "RTEXITCODE handleModifyMedium(HandlerArg*)" at line 692 of file VBoxManageDisk.cpp
The command I am running is vboxmanage modifymedium OD.VDI --compact
Please can anyone give me some advice.
I have a Windows guest Win 7 x64 in a VDI, it has gotten to a size that I would like to compact it as my linux host Ubuntu 16.04 LTS only has a small SSD.
I have removed any large files in the guest, defragged and ran sdelete. However when I try to compact the VDI I get the following error.0%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage: error: Failed to compact medium
VBoxManage: error: Code VBOX_E_FILE_ERROR (0x80BB0004) - File not accessible or erroneous file contents (extended info not available)
VBoxManage: error: Context: "RTEXITCODE handleModifyMedium(HandlerArg*)" at line 692 of file VBoxManageDisk.cpp
The command I am running is vboxmanage modifymedium OD.VDI --compact
Please can anyone give me some advice.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Compacting Medium VDI
That looks like a host error related to the file. Nothing to do with compaction per se.
I also don't recognize the error wording. Please be aware that we do not support forked versions of VirtualBox here. Someone who forks the project has responsibility to do their own support.
I also don't recognize the error wording. Please be aware that we do not support forked versions of VirtualBox here. Someone who forks the project has responsibility to do their own support.
Re: Compacting Medium VDI
Hi mpack, many thanks for the reply, I am using the version of VirtualBox that I downloaded from the official site (Version 5.1.4 r110228 (Qt5.5.1)) I have since upgrade to the latest version (Version 5.1.6 r110634 (Qt5.5.1))
I am able to start the VM with no issues at all, I can also mount the VDI in Ubunu and access the file system. The disk image was previously a VHD which I converted to VDI using vboxmanage, I was getting the same error trying to compact the VHD I just assumed it was because it was a VHD and not VDI.
I am able to start the VM with no issues at all, I can also mount the VDI in Ubunu and access the file system. The disk image was previously a VHD which I converted to VDI using vboxmanage, I was getting the same error trying to compact the VHD I just assumed it was because it was a VHD and not VDI.
-
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: Compacting Medium VDI
Means that the file can not be found.File not accessible
vboxmanage modifymedium <absolute path>OD.VDI --compactvboxmanage modifymedium OD.VDI --compact
Unless you are in the folder that has the *.VDI file you need to give the absolute path to and include the file and extension.
Re: Compacting Medium VDI
Thanks Perry, yes I was in the directory I have also tried with the absolute path, in addition I have tried with the specific UUID of the image in question. I have just realised though that the storage format still say VHD.
UUID: 4bca9107-814e-4387-8802-353b1da81c0c
Parent UUID: base
State: created
Type: normal (base)
Location: /home/loopyludo/VHD/OD.VDI
Storage format: VHD
UUID: 4bca9107-814e-4387-8802-353b1da81c0c
Parent UUID: base
State: created
Type: normal (base)
Location: /home/loopyludo/VHD/OD.VDI
Storage format: VHD
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Compacting Medium VDI
Well, that might explain the "erroneous contents", though I thought VirtualBox ignored the extension and worked out the format in other ways. You should rename the file so that the extension correctly identifies the format.
Before you can do that you would need to unregister it from the VM - and hopefully you have not used snapshots, as that would make the entire discussion moot.
Before you can do that you would need to unregister it from the VM - and hopefully you have not used snapshots, as that would make the entire discussion moot.
Re: Compacting Medium VDI
Thanks mpack, I have just tried that, I made sure that the image was no longer listed, renamed the file to .VHD and attempted to compact, unfortunately I am getting the same error. Why would vboxmanage allow me to perform other operations on the image without any issues.
loopyludo@OD-HP146012:~/VHD$ VBoxManage showmediuminfo /home/loopyludo/VHD/OD.VHD
UUID: 4bca9107-814e-4387-8802-353b1da81c0c
Parent UUID: base
State: created
Type: normal (base)
Location: /home/loopyludo/VHD/OD.VHD
Storage format: VHD
Format variant: dynamic default
Capacity: 122104 MBytes
Size on disk: 65754 MBytes
Thanks for your patience and efforts
loopyludo@OD-HP146012:~/VHD$ VBoxManage showmediuminfo /home/loopyludo/VHD/OD.VHD
UUID: 4bca9107-814e-4387-8802-353b1da81c0c
Parent UUID: base
State: created
Type: normal (base)
Location: /home/loopyludo/VHD/OD.VHD
Storage format: VHD
Format variant: dynamic default
Capacity: 122104 MBytes
Size on disk: 65754 MBytes
Thanks for your patience and efforts
-
- Volunteer
- Posts: 2561
- Joined: 30. May 2007, 18:05
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: XP, Win7, Win10, Linux, OS/2
Re: Compacting Medium VDI
VHD compaction is not supported. You need to convert it to VDI first (correctly ).
Re: Compacting Medium VDI
Hi Martin,
Ok thanks, I thought it was, how should I convert to VDI correctly this time.
Last time I used vboxmanage clonemedium OD.VHD OD.VDI
Ok thanks, I thought it was, how should I convert to VDI correctly this time.
Last time I used vboxmanage clonemedium OD.VHD OD.VDI
-
- Volunteer
- Posts: 2561
- Joined: 30. May 2007, 18:05
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: XP, Win7, Win10, Linux, OS/2
Re: Compacting Medium VDI
You need to specify the target format with the "--format VDI" parameter for the clonemedium command.
VBoxManage clonemedium [disk|dvd|floppy] <uuid|inputfile> <uuid|outputfile>
[--format VDI|VMDK|VHD|RAW|<other>]
[--variant Standard,Fixed,Split2G,Stream,ESX]
[--existing]
VBoxManage clonemedium [disk|dvd|floppy] <uuid|inputfile> <uuid|outputfile>
[--format VDI|VMDK|VHD|RAW|<other>]
[--variant Standard,Fixed,Split2G,Stream,ESX]
[--existing]
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Compacting Medium VDI
Just a tip: if you already ran sdelete (in the guest) then cloning to VDI will do the same as compact, so there's no need for a further compaction step.
Re: Compacting Medium VDI
Many thanks indeed for all your help, I could have sworn that I had used the --format option, I obviously didn't as I have just done it again and this time I have a VDI that is a much smaller size, no need to compact.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Compacting Medium VDI
Thanks for reporting back.