[Solved] Disk content lost after detaching and reattaching vmdk files

Discussions related to using VirtualBox on Mac OS X hosts.
bbiiggppiigg
Posts: 7
Joined: 21. Sep 2018, 21:45

[Solved] Disk content lost after detaching and reattaching vmdk files

Post by bbiiggppiigg »

I was using an ova file that has an associated disk (vmdk) with 20G.
Yesterday I decided that I need more space and I'd like to resize it.
What I did was following part of the instructions listed here: stackoverflow : questions/11659005/how-to-resize-a-virtualbox-vmdk-file
First I turnoff the machine, I cloned the original vmdk file, convert it to vdi, resize the vdi, and change the storage setting so I use the vdi to boot

However, as soon as I was able to boot with the resized_vdi, all the files that I previously have are gone and I can only see the files that were originally there when I first used the ova file.

I then tried to boot with the original vmdk file, but still my files are gone.
Before this thing happen, df -h reported that I used 17G out of my available 19G
After this, df -h reports that I only use 8G out of 19G of my original vmdk

Can anyone tell me what you suspect the cause is , and whether there is anyway to restore my files ?
All my research work for the past six months is in that vmdk file ..
Last edited by bbiiggppiigg on 23. Sep 2018, 04:21, edited 1 time in total.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Disk content lost after detaching and reattaching vmdk files

Post by socratis »

bbiiggppiigg wrote:I was using an ova file
Just to get things straight; you do not "use" an OVA file, much as like you're not using a ZIP file. An OVA file is a compressed file that contains the definition of a VM plus one or more VMDK files (your "HDs"). What you do is you import an OVA and that creates your VM along with its associated disks.
bbiiggppiigg wrote:What I did was following part of the instructions listed here
You could have asked or followed the local FAQ How to resize a Virtual Drive.
bbiiggppiigg wrote:I cloned the original vmdk file
Great! Where's the original?
bbiiggppiigg wrote:I then tried to boot with the original vmdk file, but still my files are gone.
Were you (sounds like it) using snapshots? Did you merge the snapshots? Are the snapshots still there?
bbiiggppiigg wrote:All my research work for the past six months is in that vmdk file ..
I don't want to sound like your parent, but, I seriously hope you have backups.

I trust you know your Terminal since you talk about 'df'. Give me the output from the host of:
  • ls -al /Users/<you>/VirtualBox\ VMs/<YourVM>
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
bbiiggppiigg
Posts: 7
Joined: 21. Sep 2018, 21:45

Re: Disk content lost after detaching and reattaching vmdk files

Post by bbiiggppiigg »

1.
I had a snapshot around February, but I haven't ever restore to it.
I don't know what you mean by merging snapshots. Maybe thats the problem.

2.
The original disk is stored left in the same directory as it was before.
When I figured out that my files are not visible anymore when I use the new vdi file, I decided to switch back to my original vmdk fie, but still the files are gone.


3.
The output of ls -al is the following
frenetic-tutorial-vm-disk001.vmdk is the original vmdk file
disk_resized.vdi is the cloned and then modified vdi file
backup.vmdk is just a copy of frenetic-tutorial-vm-disk001.vmdk after I find all my files are gone

Code: Select all

╰─ ls -al VirtualBox\ VMs/frenetic-tutorial-vm
total 70491440
drwx------  9 bbiiggppiigg  staff          306 Sep 21 04:02 .
drwx------  7 bbiiggppiigg  staff          238 Jun  2 19:15 ..
drwx------  6 bbiiggppiigg  staff          204 Sep 21 03:58 Logs
drwx------  6 bbiiggppiigg  staff          204 Sep 21 00:20 Snapshots
-rw-------  1 bbiiggppiigg  staff   9595322368 Sep 21 03:00 backup.vmdk
-rw-------  1 bbiiggppiigg  staff  16900947968 Sep 21 04:02 disk_resized.vdi
-rw-------  1 bbiiggppiigg  staff   9595322368 Sep 20 22:59 frenetic-tutorial-vm-disk001.vmdk
-rw-------  1 bbiiggppiigg  staff         9195 Sep 21 04:02 frenetic-tutorial-vm.vbox
-rw-------  1 bbiiggppiigg  staff         9195 Sep 21 03:58 frenetic-tutorial-vm.vbox-prev
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Disk content lost after detaching and reattaching vmdk files

Post by socratis »

I have to apologize, I meant to ask for the output of "ls -alR" not simply "ls -al".
Actually, either that or an "ls -al Snapshots/". I need to see the contents of the Snapshots folder.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
bbiiggppiigg
Posts: 7
Joined: 21. Sep 2018, 21:45

Re: Disk content lost after detaching and reattaching vmdk files

Post by bbiiggppiigg »

Here is the output of ls -al Snapshots

Code: Select all

╰─ ls -al Snapshots
total 35545688
drwx------  6 bbiiggppiigg  staff          204 Sep 21 00:20 .
drwx------  9 bbiiggppiigg  staff          306 Sep 21 17:05 ..
-rw-------  1 bbiiggppiigg  staff    803449489 Feb 21  2018 2018-02-21T23-44-59-130072000Z.sav
-rw-------  1 bbiiggppiigg  staff    218759168 Sep 21 03:26 {3de8e412-be2d-46c9-a681-a7247a3bd375}.vmdk
-rw-------  1 bbiiggppiigg  staff    211288064 Sep 20 22:59 {d8e7e593-cc3f-4deb-ba2d-36ef43e1efe8}.vmdk
-rw-------  1 bbiiggppiigg  staff  16965894144 Sep 20 22:59 {f1a6e3c0-8496-4da9-b0e8-69d8476c756a}.vmdk
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Disk content lost after detaching and reattaching vmdk files

Post by socratis »

Yeap, it looks like you're having snapshots. I would suggest that you use CloneVDI to merge them and create a single VDI. You're supposed to select the last snapshot and clone/merge that one. You're on OSX, which means that you would have to install an additional software called "Wine" in order to run Windows applications. Not sure if you want to do that or not.

Unfortunately, I can't tell from the dates which is the last snapshot, as it appears that both your main VMDK and its snapshots are the product of a copy operation from the filesystem. So, right-click on the VM, "Show in Finder". That will select a VBOX file, that's the recipe of your VM. Compress it and attach it.

Also, I'd like to see a screenshot of the VirtualBox Manager window with the snapshots showing; top right in the hammer icon click the downwards arrow and select "Snapshots". If you're on HiDPI reduce the size by at least 50%. Attach that screenshot.

Attach these two files, and we take it from there...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
bbiiggppiigg
Posts: 7
Joined: 21. Sep 2018, 21:45

Re: Disk content lost after detaching and reattaching vmdk files

Post by bbiiggppiigg »

The two files are attached.
I've already have wine installed and I am able to execute CloneVDI.exe
Attachments
screenshot
screenshot
min.png (65.09 KiB) Viewed 5863 times
frenetic-tutorial-vm.vbox.zip
vbox file
(2.62 KiB) Downloaded 24 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Disk content lost after detaching and reattaching vmdk files

Post by socratis »

It seems you only have one snapshot. Click on the "Fix Example" one and select "Delete". This is going to merge the snapshot and the current state. You are going to be left with one "Current State" only after that. You could then use the CloneVDI on that single VMDK file. That file would be "VirtualBox VMs/frenetic-tutorial-vm\frenetic-tutorial-vm-disk001.vmdk".
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
bbiiggppiigg
Posts: 7
Joined: 21. Sep 2018, 21:45

Re: Disk content lost after detaching and reattaching vmdk files

Post by bbiiggppiigg »

I get an error saying that virtual box can't delete the snapshot because there are more than one child hard disk (4)
Does that mean I'm screwed ?
Attachments
min2.png
min2.png (34.57 KiB) Viewed 5857 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Disk content lost after detaching and reattaching vmdk files

Post by socratis »

First and foremost, before I forget, I asked you if you can downsize your images by at least 50%. Not everyone is blessed with HiDPI.

Secondly, it's not a good thing if you're asking a question immediately followed by "WE'RE DOOMED!!!". ;)

I do not see that from the .vbox file (well, maybe, but it doesn't make sense). Can you switch to the Media Manager (Cmd+D) and find the "frenetic-tutorial-vm*" disk, expand it so that I can take a look at its children? Post that screenshot. See paragraph #1.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
bbiiggppiigg
Posts: 7
Joined: 21. Sep 2018, 21:45

Re: Disk content lost after detaching and reattaching vmdk files

Post by bbiiggppiigg »

I know you asked me to down size my screenshots.
I originally thought you asked me to reduce the size, so I used some online compression tool to compress the png size by about 75%, but seems like this is not what you mean
I hope dpi 150 works for you.
Out of the 4 children, I guess the one with size 15.8G is more likely to be the one with all my files (as previously I almost used all my disk, which is the reason why I want to resize my disk in the first place).
Attachments
dpi150-min.png
dpi150-min.png (64.37 KiB) Viewed 5856 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Disk content lost after detaching and reattaching vmdk files

Post by socratis »

I'm sorry I didn't make it clear earlier, I meant the dimensions actually, not the file size. Mea culpa...

You have 4 children, who knows why. Out of these, as you correctly guessed it, only the "{f1a6...}.vmdk" seems to be used. Now, to make things worse, you went ahead and replaced the HD in your VM with the "disk_resized.vdi". So if you delete the snapshot, that won't help you, it might make things worse. Here's what you do:
  • Remove the VM. Choose to NOT delete the files. That will clear the mess in your media registry, but will leave all the files in your filesystem.
  • Use CloneVDI to merge the base and snapshot VMDK, that is in CloneVDI you're going to select the "{f1a6...}.vmdk" file.
  • That will create a new VDI. Build a new VM around the VDI (choose use existing hard disk). I would make a note of all my settings from my previous VM and apply them to the new one.
If you want in the future to resize a HD, just use the slider at the bottom of the at the last picture you attached. And avoid snapshots when doing things like that....
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
bbiiggppiigg
Posts: 7
Joined: 21. Sep 2018, 21:45

Re: Disk content lost after detaching and reattaching vmdk files

Post by bbiiggppiigg »

I got all my files back!!
Thank you so much.
I'll definitely make backups before doing things like this in the future.

As for the resizing part, I tried to use the GUI to resize my disk, but probably because it was originally in vmdk format, so Virtual Box will report an error and won't proceed.
When I replaced one HD with another, I though it was simply analogous to replacing disk physically, and it never occurred to me that the existence of snapshot would be a problem.

Again, I'd like to express my deepest gratitude towards what you did for me.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: [Solved] Disk content lost after detaching and reattaching vmdk files

Post by socratis »

Glad I could help! And thank you for marking the topic as [Solved]... ;)
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Disk content lost after detaching and reattaching vmdk files

Post by mpack »

bbiiggppiigg wrote: When I replaced one HD with another, I though it was simply analogous to replacing disk physically
And so it is. But you had several versions of the replacement disk to choose from, and you chose the oldest version. Hence all the missing files.
Post Reply