VHD cannot resize

Discussions about using Linux guests in VirtualBox.

VHD cannot resize

Postby dclxvi » 2. Aug 2021, 10:22

Hi,

My guest VHD (Ubuntu 20.14) became nearly full (150GB), so I shutdown and in Windows using the Virtual Media Manager I resized to 200GB using the slider.

While doing this an error occurred, which I cannot recall, so I tried again. However now the VHD has been made to 300GB, and allocated more space than I even had free on the Windows HDD. Bit the bullet, and ended up having to delete a lot of data to free up some space for Windows to work correctly and keep the VHD at 300GB.

Now, if I go into the VM and open GParted it still only shows 150GB, with no space to enlarge into. The VDH does not grow into the extra space and a lot of operations fail with "Error: Error: Disk space is low!" messages.

I cannot clone and size as I originally intended, as I only have 65GB "free" on the HDD. I definitely cannot delete and start again - the data takes 1 week to redownload and I don't have the bandwidth.

I'm a bit stumped, and hoping someone could help me.
dclxvi
 
Posts: 3
Joined: 2. Aug 2021, 10:06

Re: VHD cannot resize

Postby mpack » 2. Aug 2021, 12:10

I suggest you read: How to resize a Virtual Drive.

It sounds like you need to pay particular attention to the discussion of snapshots.

I don't know what attracted you to VHD. That format is notoriously error prone.
mpack
Site Moderator
 
Posts: 34509
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VHD cannot resize

Postby dclxvi » 2. Aug 2021, 12:31

I don't use SnapShots - I never mentioned snapshots.

I've read that link before, and I gathered my option was to clone, but as I mentioned the error the VirtualMediaManager made has now consumed most of my drive space.

What I would prefer is to remove the extra 150GB that was somehow allocated to the drive in the first place.

"I don't know what attracted you to VHD. That format is notoriously error prone."

I'm just learning here, dude. Thanks for explaining the reasons it's not ideal, and what are the common issues. Condescending to say the least.

If Fixed drives aren't supported why does the Virtual Media Manager allow you to move the slider to resize them?

So I was hoping someone could be helpful, and knew of another method.
dclxvi
 
Posts: 3
Joined: 2. Aug 2021, 10:06

Re: VHD cannot resize

Postby mpack » 2. Aug 2021, 16:01

dclxvi wrote:Condescending to say the least.

I see nothing of that nature in my previous reply, but if you do then I guess my best bet is to leave you to it, since I certainly wouldn't want to risk offending you further.
mpack
Site Moderator
 
Posts: 34509
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VHD cannot resize

Postby scottgus1 » 3. Aug 2021, 18:10

dclxvi wrote:If Fixed drives aren't supported why does the Virtual Media Manager allow you to move the slider to resize them?

Could be a bug.

dclxvi wrote: I never mentioned snapshots.

There's a lot of folks that don't mention the full story and it only comes out three forum pages, several days, and dozens of volunteer-posted suggestions later. :lol:

dclxvi wrote:What I would prefer is to remove the extra 150GB that was somehow allocated to the drive in the first place.

dclxvi wrote:if I go into the VM and open GParted it still only shows 150GB, with no space to enlarge into.

This could be because the VHD is fixed size.

The real problem with VHD is a design flaw that causes loss of the data if the host glitches while the VHD is being expanded to allow more data to be written. Dynamic VHD can die a horrible death. Fixed VHD is actually safer, because it never gets bigger so the design flaw cannot trigger.

I suspect that the VHD file itself may still be 150GB-ish in size, though Virtualbox reports it as 300GB? Or is the actual VHD file on the host now 300GB in size?

The only way that I see to get your VHD bigger and fix the size error is to mount both the existing VHD and a new drive file (Dynamic VDI would be recommended as fully supported by all Virtualbox tools, but a new fixed VHD would be OK, too) to a new Ubuntu VM. Then boot the Ubuntu VM with an Ubuntu LiveCD ISO, and clone the contents of the VHD to the new disk using whatever tool Ubuntu can provide (dd?). Then attach the new drive file to your old VM in place of the old VHD. You might have to edit the grub loader to reflect the UUID of the new disk file.

If you don't have disk space for this, you'll have to get some. I don't know of another way to fix this.
scottgus1
Site Moderator
 
Posts: 12940
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: VHD cannot resize

Postby dclxvi » 4. Aug 2021, 08:59

Firstly, thank you for the info. Very grateful.

scottgus1 wrote:
dclxvi wrote:If Fixed drives aren't supported why does the Virtual Media Manager allow you to move the slider to resize them?

Could be a bug.

I think so. I just tried another smaller resize (2GB), just to see what the error was again - in case it could be helpful. It seems the VirtualMediaManager ignores the size you chose & starts allocating _all_ available free space on the drive to the VHD, and only throws an error when the Host drive runs out of space. So once again my space that I struggled to free up is allocated to the VHD (65GB), and now it sits at 365GB.

Where can I report this?

scottgus1 wrote:There's a lot of folks that don't mention the full story and it only comes out three forum pages, several days, and dozens of volunteer-posted suggestions later. :lol:

I can understand the frustration with that :) No snapshots. Just busy learning the Linux environment etc.

scottgus1 wrote:The real problem with VHD...

Ah, I understand. Thank you. I started with a VDI on my first VM, but I quickly needed to re-expand etc, so I chose the Fixed Size on the second VM as it says it is faster, and since I had code that was pulling a lot of data and writing it to the drive... I wish I had stayed with VDI :lol:

scottgus1 wrote:I suspect that the VHD file itself may still be 150GB-ish in size, though Virtualbox reports it as 300GB? Or is the actual VHD file on the host now 300GB in size?


It is actually a 365GB file on the Host HDD now. If I navigate to the VM location (C:\Users\dclxvi\VirtualBox VMs\Daemons) on the Host HDD, Daemons.vhd is 365GB.

scottgus1 wrote:The only way...
If you don't have disk space for this, you'll have to get some. I don't know of another way to fix this.

Thank you for the full explanation. It's as I feared :(

Gonna have to bite the bullet and buy another SSD. Corona has not been friendly to the pocket as many of us know.
dclxvi
 
Posts: 3
Joined: 2. Aug 2021, 10:06


Return to Linux Guests

Who is online

Users browsing this forum: No registered users and 15 guests