VirtualBox

Ticket #9103 (reopened defect)

Opened 5 years ago

Last modified 3 weeks 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 5 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 5 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 5 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 5 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 5 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 4 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 4 years ago by Corvin

  • Status changed from closed to reopened
  • Resolution invalid deleted

comment:8 Changed 4 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 4 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 2 years 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 18 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

comment:12 Changed 12 months ago by david.fraser

I've tested this in VirtualBox 4.3.10 running on Ubuntu; resizing the base image and all snapshots worked successfully, and after restarting VirtualBox I could go back to a snapshot and the increased disk space was visible with fdisk -l (of course, you need to get your guest operating system to adjust the disk partitions to be able to use the space at any point):

$ VBoxManage modifyhd base.vdi --resize 30000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
$ VBoxManage modifyhd Snapshots/\{85332f93-dc84-4a86-9738-364a8331561d\}.vdi --resize 30000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
$ VBoxManage modifyhd Snapshots/\{69469bae-e563-412b-8acc-a2f961d1ae43\}.vdi --resize 30000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

So I think this ticket should be marked as fixed...

comment:13 follow-up: ↓ 15 Changed 11 months ago by jimav

david.fraser - what exactly did you do to resize a vdi with snapshots?

Simply running VBoxManage modifyhd ... on the base .vdi and all Snapshots .vdi files did NOT work for me using VirtualBox 5.0.6r103037

$ cd $HOME/'VirtualBox VMs/vmname'
$ for f in *.vdi Snapshots/*.vdi ; do VBoxManage modifyhd "`pwd`/$f" --resize  16000 ; done
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

...but the guest OS still thinks the physical disk is still 8GB (according to gparted)

comment:14 Changed 10 months ago by S8ER

I just had this error after successfully running the command on the exact same vdi (no snapshots).

bash-3.2$ VBoxManage modifyhd W10New.vdi --resize 80000
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize medium operation for this format is not implemented yet!

5.0.10 r104061

I expanded the vdi...booted the VM and discovered I had it set higher than I wanted. Now when I attempt to resize I get the error on both the original vdi and the clone I created using humber81s method.

comment:15 in reply to: ↑ 13 Changed 3 weeks ago by david.fraser

Replying to jimav:

david.fraser - what exactly did you do to resize a vdi with snapshots?

Sorry I didn't reply earlier; as far as I recall I did exactly the same as you, so I'm not sure why it's not working... and haven't tried again since I wrote that

comment:16 Changed 3 weeks ago by frank

Please be aware that increasing the size of VDI images is implemented while decreasing the size is not. Probably this explains the VBOX_E_NOT_SUPPORTED error message.

I don't think it's really necessary to decrease the size of a virtual disk image. Keep in mind that the guest OS will only occupy space according to the guest partition. As long as you didn't change the guest partition information (e.g. using gparted) the virtual disk image will not grow further.

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use