1

I wanted to resize an 80GB vmdk on an ubuntu server. I used

VBoxManage clonehd /path/to/file.vmdk" --format vdi
VBoxManage modifyhd "/path/to/file.vdi" --resize 256000
VBoxManage clonehd "/path/to/file.vmdk" --format vmdk

to resize the vmdk size.

Then, I deleted the 80gb virtual hard disk entry via phpvirtualbox in the manager for virtual media and imported the 250gb virtual hard drive. It worked fine and booted up, but then I saw that the Win Server 2008 was in a 2 year old state.

I found out it was because of a snapshot that was not inbound due to the removal of the 80gb vmdk entry in the media manager. The new 250gb vmdk does not have any snapshots connected to it.

The snapshots in vmdk file format are not and never were shown in the "snapshots" overview, yet in the virtual media manager attached to the referring virtual hard drives.

virtual media manager

The two other virtual hard drives still have the original configuration, base vmdk and one snapshot. Can I manually rebuild the config file or can I merge the base vmdk with the snapshot vmdk on command line?

VBoxManage clonevm Infor_LN --snapshot \{35dd536c-6e3d-4c62-9b0b-065cc40a59c1\}
VBoxManage: error: This machine does not have any snapshots

As a workaround I wanted to use CloneVDI for windows, so I copied all files onto an external hard drive and get the error

"Compressed VMDKs are currently not supported"

How to merge the vmdk with the snapshot?

7
  • If it is such an old state would the snapshot still be needed? If you delete the snapshot (not discard) VBox should do a merge. Alternatively you could do a clonevm without any parameters which should get you the current state of the VM.
    – Seth
    Commented Jan 16, 2017 at 13:25
  • Thats the thing. The base VM is a really old state and I wanted to merge but since the config file was screwed over VboxManage cant merge because the VMDK is stated in config to have no snapshots
    – siryx
    Commented Jan 16, 2017 at 13:50
  • Is that VM currently functional with the old hdd file? So can you bring it up and running? If it is you should be able to use vboxmanage showvminfo <vm> to find out what disk is currently being used. Otherwise you should be able to find Snapshots in the Snapshots directory of the specific VM.
    – Seth
    Commented Jan 16, 2017 at 14:01
  • The 2 year old vmdk file does boot on its own, the data that was changed in the last 2 years is saved in a snapshot. imgur.com/a/ULbWY
    – siryx
    Commented Jan 16, 2017 at 14:20
  • From my understanding you're not missing information on your second and third disk but rather your primary disk that is now 250gb in size, right? So did you try to reattach the old 80gb file to see whenever that would get you the state you would like to have and/or did you check the actual VM directory on the console to see whenever the old snapshot files that belong to the 80 gb file are still there? Do you have a backup of those files in case you would need them?
    – Seth
    Commented Jan 16, 2017 at 14:24

1 Answer 1

0

If you have multiple VMDK files you could try this assuming you have any idea of the order of the snapshots. Maybe the last modification time of the old files could give you an idea about that.

Otherwise if you have no backup of the .vbox file you could try to manually edit that file to include the appropriate information. It's not recommended (with good reason) but it doesn't look like you have much of a choice otherwise. From a short test by creating a dummy VM and just instantly creating multiple snapshots it looks like it's nested structure. As such, if you have to deal with multiple possible snapshots, it's probably not going to be enjoyable.

My approach would be to use the 80 gb file and create a new snapshot, halt the VM and modify the .vbox file in such a way that references for the new snapshot point towards the old one from your backup. Alternatively you could write the whole XML part on your own as there are probably only a few lines really needed but I'm not sure which those would be.

2
  • 1
    The original config I modified is pastebin.com/1JexLvf4, my modification pastebin.com/LvTzhp8Z and it seems to work. I tried this earlier on my own but seems like the order of the hard drives 2-3-1 instead of 1-2-3 made something break inside. For now, it boots up and data is there. It even worked with the 250GB virtual hd
    – siryx
    Commented Jan 16, 2017 at 15:24
  • Nice, that's unexpected. Would've assumed that there was more correlation between the files for the snapshots.
    – Seth
    Commented Jan 17, 2017 at 6:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .