Echoes of my mind‎ > ‎Scribbles‎ > ‎

De-cloning VMs

So I use a Base VM and then make linked clones from that to save on space and to ensure that different development environment needs do not interfere with each other. This works awesomely... Except that, eventually you need to update the OS on the Base VM, which means every clone is now bloated, so the only real solution is to start over with a new Base VM etc etc. It's almost enough to make it not worth using linked clones (it's really not). This time however, I had nixed all but one of the linked clones already, so - why can't I just delete the intermediate snapshot and "de-clone" the Base VM and the clone VM to get a single no-snapshot, no clone VM? I can!

First, make a backup of both the Base VM and the Clone VM folders. Menu > Machine > Show in Explorer to find them.


   

What you need is an unbroken line of snapshots rather than a tree. First, in the snapshots of the Base VM, Restore the snapshot that is the "Linked Base for Base VM and Clone VM". De-select the option to keep a snapshot of the current state, we don't want it. 


In the Virtual Media Manager (in the File menu), you'll see under the Base VM.vdi two {long-guid}.vdis. One is the clone and one is the "current state" of the Base VM - the file location in the attributes can tell you which. We need to Release both of them, and Remove the "current state one" (it will be the smaller one). To keep things tidy, Move the Clone VDI from the Clone's snapshot folder to the Base VM's snapshot folder. You can also rename the Base VM.vdi by "moving" it to the same folder with a different name (E.g. Clone VM.vdi). We're done with the Virtual Media Manager, you can close it. And now that we've moved everything into the Base VM, we can Remove (Delete all files) the Clone VM. Menu > Machine > Remove.

  


In the Settings of the Base VM; Under General, you can rename it (e.g. Clone VM). Under Storage, with the Controller selected, click the Adds a hard disk icon and add the {long guid}.vdi that we moved into the snapshots folder. You will see the "root" VDI in the list of Storage Devices. Click OK. 

Finally, we can delete the "Linked Base for Base VM and Clone VM" - this may take awhile as it's reintegrating all the changes from {long guid}.vdi back into Clone VM.vdi. 

That's it, We're done! Much easier than editing the xml files that I did the first time...


Comments