Page 1 of 1

Resize VHD in Windows 7 32Bit

Posted: 1. Oct 2012, 10:32
by TomW
Hello,

as vboxmanage modifyhd xxxx --resize yyyy does not adjust the physical structure of the VHD I used VhdResize but have to resolve an issue with that:

Virtualbox 4.2.9 r80737 German
C:\Virtual Box VMs\XP Basis\XP Basis.VHD with 10 GByte

1. Expanded XP Basis.VHD with VhdResize to C:\Virtual Box VMs\XP Erweitert.VHD with 20 GByte
2. Add C:\Virtual Box VMs\XP Erweitert.VHD using "New" and "Use existing image" named "XP Erweitert"

Result

C:\Virtual Box VMs\XP Erweitert.VHD
C:\Virtual Box VMs\XP Erweitert\xxxx.VBOX
C:\Virtual Box VMs\XP Erweitert\yyyy.VBOX-PREV
C:\Virtual Box VMs\XP Erweitert\Logs

Unfortunately the VHD and Configfiles/Log are not in the same directiry. Is the a way to get this done ?

If XP Erweitert.VHD is created in directory

C:\Virtual Box VMs\XP Erweitert

Add fails with error message, that the direcory provided cannot be created.

Thanks for any hint about this and kind regards,

Tom

Re: Resize VHD in Windows 7 32Bit

Posted: 1. Oct 2012, 10:59
by mpack
Use the GUI to unregister (but not remove) the VHD in its current location. Shut down VirtualBox, wait 30 seconds, move the VHD into its new location, start VirtualBox and mount the VHD.

Incidentally, VHDs are not reliable. You should consider converting it to VDI before using it. In that case you would not also encounter limitations in VirtualBox's handling of this third party format.

Re: Resize VHD in Windows 7 32Bit

Posted: 2. Oct 2012, 09:10
by TomW
@mpack

Thanks for your reply and information about reliability of VHDs. As I did not find the "unregister" command in GUI and accidently used "remove" for the VHD named

Windows XP Erweitert

I did the following:

1. ReImport Windows XP Erweitert.VHD from it's old location with Machine\Add (Machine\Hinzufügen) .VBOX file
2. Close Virtualbox
3. Copy Windows XP Erweitert.VHD to directory C:\Virtual Box VMs\XP Erweitert\
4. Use Notepad++ with XML-Extension to modifiy .VBOX file for Windows XP Erweitert.VHD using the new path to the VHD
5. Restart Virtualbox

This did work and meanwhile I found the "unregister" feature as command line function in section 9.3.5.1 of the Virtualbox manual

http://docs.oracle.com/cd/E26217_01/E35 ... -vbox.html

Thanks and kind regards,

Tom

Re: Resize VHD in Windows 7 32Bit

Posted: 2. Oct 2012, 11:43
by mpack
Actually, my previous response was badly worded. "Unregister" was intended as a generic term, correct in the functional sense but the menu/dialog boxes use other words. The quickest way to unregister a disk is to go to File | Virtual Media Manager, highlight the disk and select "Release" (which unmounts the disk from all VMs), then "Remove" (which unregisters the disk from whatever media registry had it). At that point you are asked if you want to delete the file on disk, you say no! Then you would shut down VBox, wait 30 seconds, start up again, then use VM settings | Storage to mount the drive from its new location.

... Or you could simply shut down VBox and edit the .vbox file manually as you did - but that obviously requires an understanding of XML syntax rules hence isn't something we recommend to everyone. Basically you're on your own if you do that.