Restore VM from Base VMDK and snapshots created by Virtualbox on a headless ubuntu Server

Discussions related to using VirtualBox on Linux hosts.
Post Reply
siryx
Posts: 3
Joined: 16. Jan 2017, 14:41

Restore VM from Base VMDK and snapshots created by Virtualbox on a headless ubuntu Server

Post by siryx »

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

Code: Select all

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.

imgur com/a/ULbWY

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?

Code: Select all

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?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Restore VM from Base VMDK and snapshots created by Virtualbox on a headless ubuntu Server

Post by mpack »

Be careful with terminology.

Snapshots always involve the use of differencing images. For that reason people sometimes use the terms synonymously, but in fact not all differencing images are related to snapshots.

For example, differencing images are also used by linked clones, immutable drives, and... when someone has (mis)used a compressed VMDK directly in a VM, instead of properly importing the appliance it was originally part of. It sounds like yours is the latter case, as compressed VMDKs only occur in an exported appliance.

You should restore the unresized VM from your backup, then use the GUI to clone the VM (not the VMDK) to a new VM, current state only. That will give you a VM which uses VDI format disks (the correct choice for VirtualBox users), which you can easily resize.
siryx
Posts: 3
Joined: 16. Jan 2017, 14:41

Re: Restore VM from Base VMDK and snapshots created by Virtualbox on a headless ubuntu Server

Post by siryx »

I stopped all vbox* services and manually made changes to the Servername.vbox. To do so I copied the syntax of the two other hard drives and it rebound the snapshot. It does work now.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Restore VM from Base VMDK and snapshots created by Virtualbox on a headless ubuntu Server

Post by mpack »

Perhaps, but that would mean you are still using a compressed vmdk incorrectly, so I suspect you are just storing up more problems for the future. Your procedure is a workaround, whereas the procedure I gave you is a permanent solution.
siryx
Posts: 3
Joined: 16. Jan 2017, 14:41

Re: Restore VM from Base VMDK and snapshots created by Virtualbox on a headless ubuntu Server

Post by siryx »

I will do that now will all of its hard drives, but I had to get everything up and working first. To not run into these problems in the future and for backing up data it is way easier like that. And yes, the compressed vmdk used to be given out to my predecessor. It was intended to be run in a VMware but he migrated everything to the headless linux server. The vmdk that i cloned in the first step was infact the original state from when it was given out. All changes are saved in that "snapshot" or differenting image. When the snapshot is inbound though, the size extension to 250 instead of 80gb is not applied though. Do I have to clone and resize afterwards? Theres no unallocted space now when I check with disk manager using the guest os.
Post Reply