VirtualBox

Ticket #9103 (reopened defect)

Opened 4 years ago

Last modified 2 months ago

modifyvm --resize doesn't work

Reported by: jonsiddle Owned by:
Priority: major Component: virtual disk
Version: VirtualBox 4.0.8 Keywords: modifyhd resize
Cc: Guest type: other
Host type: Linux

Description (last modified by frank) (diff)

I have a 20GB dynamic .vdi which I want to resize to 40GB so I issue:

VBoxManage modifyhd /full/path/to/hd.vdi --resize 40960

and it responds (instantly) with:

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Running VBoxManage showhdinfo on the image tells me:

... Logical size: 40960 MBytes Current size on disk: 18464 MBytes Type: normal (base) Storage format: VDI Format variant: dynamic default ...

and also reports the same logical size for the snapshot files.

The problem is that gparted reports that the drive is still 20G (not the partition; the whole drive).

Windows disk management also sees the drive as 20G.

It looks like while VirtualBox can see the new logical size, it's not reporting it to the guest correctly.

Change History

comment:1 Changed 4 years ago by long

So I ran into this same problem and the reason it doesn't work is because you have snapshots. I hope you have a backup of your .vdi before you resized it because you will need it. Basically you will need to fall back to the original .vdi and then delete all of your snapshots before trying to resize it. It seems to me that modifyhd shouldn't let you resize a .vdi that has snapshots associated with it.

comment:2 Changed 4 years ago by klaus

  • Status changed from new to closed
  • Resolution set to invalid

Sorry, the answer by the previous user is not correct.

You can resize a VM which has snapshots, but you must resize the right thing.

Resizing the first snapshot (more accurately the base image) only affects that one. It doesn't magically change anything else.

So what you need to do is to identify the diff image which is associated with "Current State", i.e. what is attached to the VM. This image needs to be resized.

This is working correctly, so I'm closing this ticket.

comment:3 Changed 4 years ago by thierrybo

Please explain what you mean by "identify the diff image which is associated with "Current State", i.e. what is attached to the VM. "?

I look for my HOME .VirtualBox folder and only found the base vdi and snapshots. Where is the Current State?

comment:4 Changed 4 years ago by frank

Have a look at VBoxManage showvminfo VM_NAME. The status text contains the current hard disks which is attached to the VM. If the VM has a snapshot, the information will show the current differential image.

comment:5 Changed 4 years ago by thierrybo

OK, but I just see snapshots I can already see in the GUI, but not further "current state". IF I run:

VBoxManage modifyhd "~/.VirtualBox/Machines/XPPRO/Snapshots/{6a9489b3-3d02-4492-b0f4-00b4027a1925}.vdi" --resize 25000

on the last snapshot I get: Progress state: VBOX_E_NOT_SUPPORTED VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

but it works on the base vdi

comment:6 Changed 3 years ago by Corvin

I'm having exactly the same problem as thierrobo wrote. Using VB 4.1.22

I've run the resize action on my primary vdi file, it completed successfully. I run VBoxManage showvminfo on my machine, looked at what UUID is associated with my current state HDD snapshot, run showhdinfo on that, it shows the new, resized logical size. But the guest OS still sees the old size. modifyhd on the UUID of the snapshot throws VBOX_E_NOT_SUPPORTED.

Oracle folks, please explain the steps that we need to do for the guest OS to see the updated size.

Thanks

comment:7 Changed 3 years ago by Corvin

  • Status changed from closed to reopened
  • Resolution invalid deleted

comment:8 Changed 2 years ago by JSW

I am seeing the same not supported message using VirtualBox 4.2.4

VBoxManage modifyhd \{5f4afe34-8165-4f90-b3b5-1e9d88716cad\}.vdi --resize 40960
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

Please advise ASAP

comment:9 Changed 2 years ago by frank

  • Description modified (diff)

Resizing of differential images is not supported. To resize the hard disk you have to merge the differential images with the base image (delete all snapshots) and then resize the base image. And resizing does only work if you increase the size, decreasing is not implemented.

comment:10 Changed 14 months ago by carter

I ran into this same problem: I resized the original disk image, did not see the new size in the guest, found this bug. Then I tried to delete the snapshots, but virtualbox crashed while merging the first snapshot.

Suggestion: The resize command should fail when applied to a disk image attached to a VM that has snapshots. In the meantime please update the documentation of modifyhd and add a warning that this command will not work correctly and will cause data loss if you have snapshots.

comment:11 Changed 2 months ago by humber81

Hello All

I already tested a solution for the issue with the resize command, here i explain what i did:

First, remove your virtual disk from the virtual machine (note: just remove from the list not delete it from your host machine)

Second, resize the virtualdisk.

Third, add again your virtual disk to the virtual machine and when you have been added you can check that the size is the correct on the properties of the harddisk into your VM.

now for assign the free space added you need to do it with a live cd and the gparted tool if you are using linux on the guest machine, on windows just with the disk management can do it.

for the VBOX_E_NOT_SUPPORTED error, that's occurred because if you are trying to expand a disk with VMDK format, the 'VBoxManage modifyhd' command don't support this type of format just VDI or VHD, for resize this type of disk format first need to be cloned with the 'VBoxManage clonehd' command specifying the new format and extension for the output harddisk file, then resize the cloned harddisk and add it to the virtual machine (the original disk can be removed from the list without problems before turn on the VM because both virtual disks have the same data stored, just the size is different).

Here i put you the example that i tested too with a cloned harddisk:

[humberto@Fedora-Toshiba OL6]$ VBoxManage modifyhd OL6HardDisk1.vmdk --resize 51200 0% Progress state: VBOX_E_NOT_SUPPORTED VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

[humberto@Fedora-Toshiba OL6]$ VBoxManage clonehd OL6HardDisk1.vmdk OL6HardDisk1.vdi --format VDI 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Clone hard disk created in format 'VDI'. UUID: 3ad33b28-9a1e-462e-bbd0-b34fb56829f2

[humberto@Fedora-Toshiba OL6]$ VBoxManage modifyhd OL6HardDisk1.vdi --resize 51200 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% [humberto@Fedora-Toshiba OL6]$

Well i hope this help to everybody to solve this problem.

Regards

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use