Page 1 of 1
Accessing data in snapshot
Posted: 10. Nov 2020, 03:00
by Plagioclase
As a preface, I screwed up - I've been using a Virtual Box Ubuntu snapshot (Windows host, Ubuntu guest) for the past half a year because I didn't know what I was doing. I now realise that I should not have been doing this. What I'm desperately trying to do at the moment is to recover data fron the snapshot.
I had a hardware failure (whilst the snapshot was open) but managed to save the entire VM folder before I lost all the data. I honestly do not entirely understand what snapshots are, but in the parent directory I have two .vbox files and a .vdi, which seem to correspond to the state of the system before I took the snapshot. On a different Windows PC, I can use the .vbox file to resume the virtual machine in Virtual Box, but it's half a year out of date, so presumably after I accidentally made the snapshot, I continued to work on the snapshot rather than the base version.
In the Snapshots subdirectory, there is a .vdi file which must be the virtual machine I've been working on. But this doesn't appear in the snapshots view in Virtual Box, despite the Snapshot Folder in the settings being correct. So I don't know how to resume this snapshot. The most important thing for me is some files within the snapshot rather than the snapshot itself, but I cannot extract files from the snapshot .vdi with 7zip (which does work for the base .vdi).
Is there anything that I can do to access this data or am I buggered?
Re: Accessing data in snapshot
Posted: 10. Nov 2020, 18:32
by scottgus1
Sounds like the hardware error glitched the .vbox file. There should be a .vbox-prev file there too. If not too many attempts to start the guest have occurred, the .vbox-prev might hold the guest configuration that still references the snapshot. You could try:
Reboot your host so no Virtualbox processes are running.
Rename the guest's .vbox file extension (both if there's more than one) to .vbox-old
Rename the .vbox-prev to .vbox.
Open Virtualbox and check the guest's snapshots.
If the snapshot now shows up and the "Current State" under it is highlighted, try the guest.
If the snapshot does not show, then we'll have to clone the snapshot:
Download Mpack's
CloneVDI.
Move the snapshot .vdi into the folder with the base .vdi and the .vbox files.
Point CloneVDI at the snapshot .vdi and make a new clone .vdi
Now add the new clone .vdi to the guest as a second drive and boot the guest. You may have to mount the new drive inside the guest, but you should be able to get the recent files.
FWIW a snapshot .vdi only contains changed disk sectors, not necessarily whole files, so a snapshot disk is useless without the base disk.
FWIW2 you should be taking backups that allow you to get access to your data anywhere at any time. Not only host disk images with the guests all shut down properly, but in-the-guest backups of important data too. Then this hardware problem would not really have been that much of a problem.
Re: Accessing data in snapshot
Posted: 10. Nov 2020, 23:50
by Plagioclase
Hi scottgus, thanks for your reply! I've followed your suggestions in your first paragraph and the snapshot indeed appears with "Current State (changed)" highlighted. However, upon powering on the guest, it resulted in some errors on a black screen, followed by a completely black screen. The VM also refused to close when I tried to power it off, hanging on "stopping" and I ended up having to force close it. When I try to restart the VM, it returns a "FATAL: Could not read from boot medium. System halted." error and the external HDD it's stored on is ejected (the SSD on the laptop I'm trying this on isn't large enough to store the VM locally). Do you have any suggestions? Is it worth trying your cloning suggestion in this case?
Edit: Successs! By disabling the USB controller and switching the Graphics Controller to VBoxVGA, I have managed to boot into the snapshot. Thank you so much, I thought this data was lost! One last question - since I had to disable the USB controller to boot into the snapshot, I can't move stuff onto my external hard drive. Is there any other way to move large files back onto my host or External HDD?
Edit 2: Have managed to screw everything up again by trying to set up shared folders - it's now hanging when Ubuntu is loading (the dots) even when I remove the shared folders again. Will try again tomorrow...
Re: Accessing data in snapshot
Posted: 11. Nov 2020, 19:18
by scottgus1
Having trouble after changing in the .vbox-prev was expected.
If you cannot get the data out via shared folders, try the clone idea.
Shared folders set up through Virtualbox requires working Guest Additions in the guest OS.
Re: Accessing data in snapshot
Posted: 14. Nov 2020, 22:18
by Plagioclase
I've managed to get the most important data out of the snapshot, so thank you very much for your help! Is there now a way to 'un-snapshot' this snapshot? I could just set up a new VM but there was a bunch of software that was nicely configured on the old VM snapshot and it would definitely speed things up if I could use that snapshot as a proper, unsnapshotted VM.
Re: Accessing data in snapshot
Posted: 15. Nov 2020, 01:51
by scottgus1
You can clone the VM as a full clone using the current state, and the new VM will have no snapshots.