Problems expanding hard drive on VM

Discussions related to using VirtualBox on Windows hosts.
Post Reply
AW-1992
Posts: 18
Joined: 6. Mar 2023, 02:41

Problems expanding hard drive on VM

Post by AW-1992 »

I have a vm called MainSvr-AW that has 20gb. I need to increase the disk space to install something. When I first made it, I set it to fixed disk size, thinking it would be easy to increase the size later if I needed to. I was wrong.

Following this thread: viewtopic.php?f=35&t=50661

My VM has snapshots, but im on virtualbox 7.0.

I went to file>tools>virtual media manager to increase my disk size. I can't see MainSvr-AW in there, because I named the disk images in confusing ways, so I just increased the size of all of them. I think I named it seve1.vdi, but theres also a snapshot under that. I increase all of them to about 30.

I boot MainSvr-AW's windows OS and it does not detect any unallocated partitions.

I mount a GParted disk image and it does not detect any unallocated partitions.

I see that the thread viewtopic.php?f=35&t=50661 says its not easy to resize a VM that is on fixed disk size or has a snapshot. I try to clone it using their instructions. I installed virtualbox on my c drive but moved the vms to another drive. I try to use that command in there but it throws up an error:

Code: Select all

C:\Program Files\Oracle\VirtualBox>vboxmanage clonehd seve1.vdi clonetest1.vdi --format vdi --variant standard
VBoxManage.exe: error: Could not find file for the medium 'C:\Program Files\Oracle\VirtualBox\seve1.vdi' (VERR_FILE_NOT_FOUND)
VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium, callee IUnknown
VBoxManage.exe: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 205 of file VBoxManageDisk.cpp

C:\Program Files\Oracle\VirtualBox>vboxmanage clonehd MainSvr-AW.vbox clonetest1.vdi --format vdi --variant standard
VBoxManage.exe: error: Could not find file for the medium 'C:\Program Files\Oracle\VirtualBox\MainSvr-AW.vbox' (VERR_FILE_NOT_FOUND)
VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium, callee IUnknown
VBoxManage.exe: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 205 of file VBoxManageDisk.cpp
Seems like it can't find what im trying to clone.

I try to do vboxmanage in the directory that my vms are in, but it doesn't support the command in there.

I try to increase size of the drive using CLI, it seems successful:

Code: Select all

C:\Program Files\Oracle\VirtualBox>vboxmanage modifyhd "D:\VMs\MainSvr-AW\seve1.vdi" --resize 40000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Gparted and windows disk management does not see the unallocated partition.

Try to clone the disk into a support format using the CLI command, can't get cmd to recognise my command even though I tried several variants of it

Code: Select all

C:\Program Files\Oracle\VirtualBox>vboxmanage modifyhd "D:\VMs\MainSvr-AW\seve1.vdi"  --format VDI --variant Standardvbox
Oracle VM VirtualBox Command Line Management Interface Version 7.0.6
Copyright (C) 2005-2023 Oracle and/or its affiliates

VBoxManage.exe: error: unknown option: --format

Usage - Change the characteristics of an existing disk image:

  VBoxManage modifymedium [disk | dvd | floppy] <uuid | filename> [--autoreset=on | off] [--compact] [--description=description] [--move=pathname] [--property=name=[value]]
      [--resize=megabytes| --resizebyte=bytes] [--setlocation=pathname] [--type=normal | writethrough | immutable | shareable | readonly | multiattach]

C:\Program Files\Oracle\VirtualBox>vboxmanage modifyhd "D:\VMs\MainSvr-AW\seve1.vdi" "D:\VMs\MainSvr-AW\seve1test.vdi" --format VDI --variant Standardvbox
Oracle VM VirtualBox Command Line Management Interface Version 7.0.6
Copyright (C) 2005-2023 Oracle and/or its affiliates

VBoxManage.exe: error: Invalid parameter 'D:\VMs\MainSvr-AW\seve1test.vdi'

Usage - Change the characteristics of an existing disk image:

  VBoxManage modifymedium [disk | dvd | floppy] <uuid | filename> [--autoreset=on | off] [--compact] [--description=description] [--move=pathname] [--property=name=[value]]
      [--resize=megabytes| --resizebyte=bytes] [--setlocation=pathname] [--type=normal | writethrough | immutable | shareable | readonly | multiattach]

C:\Program Files\Oracle\VirtualBox>modifymedium disk
'modifymedium' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\Oracle\VirtualBox>modifydisk
'modifydisk' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\Oracle\VirtualBox>vboxmanage modifyhd "D:\VMs\MainSvr-AW\seve1.vdi" "copytest.vdi" --format VDI --variant Standardvbox
Oracle VM VirtualBox Command Line Management Interface Version 7.0.6
Copyright (C) 2005-2023 Oracle and/or its affiliates

VBoxManage.exe: error: Invalid parameter 'copytest.vdi'

Usage - Change the characteristics of an existing disk image:

  VBoxManage modifymedium [disk | dvd | floppy] <uuid | filename> [--autoreset=on | off] [--compact] [--description=description] [--move=pathname] [--property=name=[value]]
      [--resize=megabytes| --resizebyte=bytes] [--setlocation=pathname] [--type=normal | writethrough | immutable | shareable | readonly | multiattach]
Can someone please tell me in idiot terms how I can change the disk size
Logs.rar
(168.11 KiB) Not downloaded yet
AW-1992
Posts: 18
Joined: 6. Mar 2023, 02:41

Re: Problems expanding hard drive on VM

Post by AW-1992 »

Trying to use viewtopic.php?f=6&t=22422 to clone my disk right now (I was under the impression that I already cloned it in virtualbox's gui, but maybe not)

Cloned disk using the tool. Mounted the cloned disk into my virtual machine's sata port and then booted Gparted. Successfully increased size of partition. Tried to boot into windows using the cloned disk. Get an error message from virtualbox saying it failed to boot.

Mount original vdi file into virtual machine's sata port. Can't boot.

Followed instructions here, still can't boot. https://superuser.com/questions/1030579 ... ge-setting

Kind of funny I just wanted to do a simple thing and now messed up even my original vdi.

Log
MainSvr-AW-2023-03-19-22-34-25.rar
(29.68 KiB) Downloaded 1 time
AW-1992
Posts: 18
Joined: 6. Mar 2023, 02:41

Re: Problems expanding hard drive on VM

Post by AW-1992 »

Tried this: https://www.youtube.com/watch?v=WHxmCSSqTO4

Didn't boot (same problem as before as well as new problem)

Deleted that new machine

Somehow deleted my clone vdi in the process

Remade clone vdi using the tool

Virtual machine failed to boot

Tried mounting windows server 2016 iso as the dialog suggested, still failed to boot
Attachments
clonetest3-2023-03-19-23-05-48.rar
(29.37 KiB) Downloaded 3 times
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Problems expanding hard drive on VM

Post by scottgus1 »

At this point, I think all you can do is restore the VM from your host backups.

You found How to Resize a Drive and Mpack's CloneVDI, good.

Reading through the posted info, it looks like part of your troubles were from improperly-configured command lines.
AW-1992 wrote:C:\Program Files\Oracle\VirtualBox>vboxmanage clonehd seve1.vdi clonetest1.vdi --format vdi --variant standard
VBoxManage.exe: error: Could not find file for the medium 'C:\Program Files\Oracle\VirtualBox\seve1.vdi' (VERR_FILE_NOT_FOUND)
AW-1992 wrote:C:\Program Files\Oracle\VirtualBox>vboxmanage modifyhd "D:\VMs\MainSvr-AW\seve1.vdi" --resize 40000
Notice that the second command, which completed, shows the disk file at "D:\VMs\MainSvr-AW\seve1.vdi". But the failed previous command looked for the disk file at 'C:\Program Files\Oracle\VirtualBox\seve1.vdi'. This is because the full path to the vdi wasn't included in the command line, so the command looked for the vdi in the folder the command was running in, "C:\Program Files\Oracle\VirtualBox". The vdi isn't there, hence, VERR_FILE_NOT_FOUND.

**********************
AW-1992 wrote:C:\Program Files\Oracle\VirtualBox>vboxmanage modifyhd "D:\VMs\MainSvr-AW\seve1.vdi" --format VDI --variant Standardvbox
...
VBoxManage.exe: error: unknown option: --format
Syntax error here, the command doesn't have a --format switch. Same thing with:
AW-1992 wrote:C:\Program Files\Oracle\VirtualBox>vboxmanage modifyhd "D:\VMs\MainSvr-AW\seve1.vdi" "copytest.vdi" --format VDI --variant Standardvbox
...
VBoxManage.exe: error: Invalid parameter 'copytest.vdi'
**********************
AW-1992 wrote:When I first made it, I set it to fixed disk size
AW-1992 wrote:theres also a snapshot under that
AW-1992 wrote:the thread viewtopic.php?f=35&t=50661 says its not easy to resize a VM that is on fixed disk size or has a snapshot.
Very true, This disk is configured in just about unexpandable ways, unfortunately.

CloneVDI can clone an entire snapshot string to a new standalone single disk for a new VM. But if previous attempts to alter the disks were damaging, then CloneVDI might not be able to do anything with them.

Either get your backups out and try to clone the latest snapshot vdi with CloneVDI per the app's instructions (without trying "variants" of the commands, wink nudge).
AW-1992 wrote:Mounted the cloned disk into my virtual machine's sata port .... Tried to boot into windows using the cloned disk. Get an error message from virtualbox saying it failed to boot.
CloneVDI's instructions say specifically that you must use a new VM to run the cloned disk. The old VM still points at all the snapshots and won't run the new disk correctly.

One more school/life lesson to learn: gotta read the instructions.

If you do start over, use dynamic disk, not fixed. Don't make snapshots; make separate backups at the various build points you would have snapshotted.
AW-1992
Posts: 18
Joined: 6. Mar 2023, 02:41

Re: Problems expanding hard drive on VM

Post by AW-1992 »

I figured I must have messed up the backup and restoration somehow and had to remake everything.
Post Reply