VBoxManage modifyhd (4.1.10) on Windows 7 not working

Discussions about using Linux guests in VirtualBox.
Post Reply
wrsmag
Posts: 2
Joined: 19. Mar 2012, 19:42

VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by wrsmag »

I've tried to increase the size of my VDI using VBoxManage modifyhd, but it is not working too well.

I've started from the Ubuntu 11.10 VDI image from virtualboxes dot org images ubuntu . I've updated that to what I want, installed the new guest additions and then wanted to increase the size. I copied the VDI to another image (to be safe and using the Virtual Media Manager) and then run

Code: Select all

VBoxManage modifyhd --resize=(100Gb) (image path)
, but the program stops and I get:

Code: Select all

C:\virtual-box\Ubuntu-11.10>VBoxManage modifyhd --resize 107374182400 Ubuntu-11_copy.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...
Progress object failure: RPC_S_SERVER_UNAVAILABLE 0x800706BA
VBoxManage.exe: error: Code RPC_S_SERVER_UNAVAILABLE 0x800706BA (0x800706BA) - RPC_S_SERVER_UNAVAILABLE 0x800706BA (extended info not available)
VBoxManage showhdinfo on the original image gives the below

Code: Select all

C:\virtual-box\Ubuntu-11.10>VBoxManage showhdinfo Ubuntu-11_copy.vdi
UUID:                 9765704b-c4c3-4a29-a3de-213891ab8a05
Accessible:           yes
Logical size:         18432 MBytes
Current size on disk: 4413 MBytes
Type:                 normal (base)
Storage format:       VDI
Format variant:       dynamic default
Location:             C:\virtual-box\Ubuntu-11.10\Ubuntu-11_copy.vdi
FYI VBoxManage version

Code: Select all

C:\virtual-box\Ubuntu-11.10>VBoxManage -v
4.1.10r76836
What am I doing wrong here?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by mpack »

I need to know what you literally used as the command. I.e. if that text inside your first code block is literally what you typed then you are in big trouble.

Otherwise, the size entered must be the desired size, in megabytes, of the disk. You will need to follow this with "Gparted" to enlarge the partition to fill the drive. For example to enlarge a drive capacity to 100GB the command would be "VBoxManage modifyhd --resize 102400 <path to vdi>".

I suspect that you tried to enlarge your drive to 107374182400MB... which is an awful lot of megabytes. Certainly it's more than the 2TB (2097152MB) VirtualBox limit.

Since you likely filled up your drive with the previous attempt, you may want to check that before trying again! And it's a good job you did this on a copy, because people have made this mistake in the past, and trashed the VDI (ahh, the joys of live mods).
wrsmag
Posts: 2
Joined: 19. Mar 2012, 19:42

Re: VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by wrsmag »

You're correct, I did write 2^30 rather than 2^20. It now works.

Sorry for the noise and thanks.
Deton@tor
Posts: 13
Joined: 1. Mar 2012, 10:24

Re: VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by Deton@tor »

I am trying to resize my hd but i am getting an error

Code: Select all

sudo VBoxManage modifyhd "/home/haorfani/VirtualBox VMs/Windows 7" --resize 1000
VBoxManage: error: The medium '/home/haorfani/VirtualBox VMs/Windows 7' can't be used as the requested device type
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component Medium, interface IMedium, callee nsISupports
Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadWrite, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 210 of file VBoxManageDisk.cpp

and here is my vdi

Code: Select all

UUID:        d22e86fa-4467-4d4c-ab77-be9383e4af47
Parent UUID: base
Format:      VDI
Location:    /home/haorfani/VirtualBox VMs/Windows 7/Windows 7.vdi
State:       created
Type:        normal
Usage:       Windows 7 (UUID: fdcc7071-c2ce-46a6-a208-e76744939fd1)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by Perryg »

@Deton@tor,

Two things here that you need to fix.
1) is the absolute path including the name and file extension.
2) supposing that you really want to have the guest at 1GB using 1000 is not the correct number. it would be 1024
Since most of the time the guest is created at 8GB to start with the 1024 would still fail as that would mean to make it smaller than the actual size.
Deton@tor
Posts: 13
Joined: 1. Mar 2012, 10:24

Re: VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by Deton@tor »

Thanks for the quick response i fixed the path and the size number but i m getting this

Code: Select all

haorfani@haorfani-EP45-DS5 ~ $ sudo VBoxManage modifyhd "/home/haorfani/VirtualBox VMs/Windows 7/Windows 7.vdi" --resize 1024
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by Perryg »

What size do you want this to be when you are finished?
Deton@tor
Posts: 13
Joined: 1. Mar 2012, 10:24

Re: VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by Deton@tor »

80 Gbytes
Deton@tor
Posts: 13
Joined: 1. Mar 2012, 10:24

Re: VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by Deton@tor »

81920 thats the parameter for 80 gbytes.. thnk you i figured out
grobelny
Posts: 2
Joined: 15. May 2011, 12:40
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Win2k8

Re: VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by grobelny »

Is there anything that can be done to restore my vdi if I made the mistake to specify size in bytes instead of megabytes? Currently any access ends with:

Code: Select all

>vboxmanage modifyhd --resize 40000 d:\vms\myvm\myvm.vdi
VBoxManage.exe: error: Could not open the medium 'd:\vms\myvm\myvm.vdi'.
VBoxManage.exe: error: VDI: invalid header in 'd:\vms\myvm\myvm.vdi' (VERR_VD_VDI_INVALID_HEADER).
VBoxManage.exe: error: VD: error VERR_VD_VDI_INVALID_HEADER opening image file 'd:\vms\myvm\myvm.vdi' (VERR_VD_VDI_INVALID_HEADER)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component Medium, interface IMedium, callee IUnknown
VBoxManage.exe: error: Context: "Resize(cbResize, progress.asOutParam())" at line 539 of file VBoxManageDisk.cpp
Also a sanity check on supplied value would be of use...
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: VBoxManage modifyhd (4.1.10) on Windows 7 not working

Post by mpack »

No, there is no tool provided which can undo the change. E.g. you can't shrink the drive back down because shrinking is not allowed.

And I assume a backup is not available?

Assuming that the answer to the latter is "no", then the only known fix is to patch the VDI header. That solution has been discussed several times, e.g. here.
Post Reply