After deleting snapshot, still have differencing image and extra disk space usage

This is for discussing general topics about how to use VirtualBox.
Post Reply
jimrandomh
Posts: 5
Joined: 21. Feb 2017, 21:25

After deleting snapshot, still have differencing image and extra disk space usage

Post by jimrandomh »

Windows host, Linux guest. I followed a procedure approximately like this:

1. Using the VirtualBox GUI, create a snapshot.
2. Perform a distro upgrade of the guest. Upgrade is auto-paused several times due to running out of disk space on the host; free disk space and unpause each time.
3. After upgrade completes, using the VirtualBox GUI, delete the snapshot

Result: disk space used by the snapshot is not recovered. The VirtualBox Media Manager shows that the virtual hard disk now has a differencing image under it, located in the VM snapshots folder. When the guest is active, the timestamp of the differencing image, not the main disk image, changes.

Is this normal behavior for VirtualBox? Googling suggests that I can merge the differencing image by cloning the disk, and deleting the original, but I would expect deleting the snapshot to have merged them automatically. Am I going to end up with an extra differencing image every time I create and delete a snapshot?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: After deleting snapshot, still have differencing image and extra disk space usage

Post by socratis »

Right-click on the VM in the VirtualBox Manager, Show in Explorer. ZIP the .VBOX file and attach it in your response (see the "Upload attachment" tab below the reply form).
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: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: After deleting snapshot, still have differencing image and extra disk space usage

Post by mpack »

I would also like to see a listing of the contents of the /Snapshots subfolder, since the claim is that orphaned snapshots (therefore not referenced by the .vbox file) are not being deleted.
jimrandomh
Posts: 5
Joined: 21. Feb 2017, 21:25

Re: After deleting snapshot, still have differencing image and extra disk space usage

Post by jimrandomh »

Here's the .vbox file. The /Snapshots folder contains {dca7b9ce-af7a-4e65-a656-4d62c8bb44b4}.vdi which is about 20GB; D:/Ubicron.vdi (the base of the VM hard disk) the storage as a whole is ~125GB (it's set to dynamically expand with a max size of 128GB). The .vbox file mentions one other disk image, which was another VM's disk that was at one point attached to pull files off it but which was detached before taking the snapshot and is detached now.
Attachments
Ubicron.zip
(2.63 KiB) Downloaded 52 times
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: After deleting snapshot, still have differencing image and extra disk space usage

Post by mpack »

The VM is still using the differencing image. Both it and the parent are required - what made you think that wasn't the case?

I don't see the folder listing I asked for.
jimrandomh
Posts: 5
Joined: 21. Feb 2017, 21:25

Re: After deleting snapshot, still have differencing image and extra disk space usage

Post by jimrandomh »

The Snapshots folder contains {dca7b9ce-af7a-4e65-a656-4d62c8bb44b4}.vdi and nothing else.

The issue is that, viewed through the GUI, there are no snapshots (just "Current State"). My expectation is that deleting the snapshot would have caused the differencing image to get merged with the base disk image; having them unmerged causes a lot of extra disk space usage.
jimrandomh
Posts: 5
Joined: 21. Feb 2017, 21:25

Re: After deleting snapshot, still have differencing image and extra disk space usage

Post by jimrandomh »

Put another way - I have a VM with a 128GB disk that is consuming 148GB of disk space, which will expand to 256GB as it's written to. The first issue is that I'd like to reduce it to 128GB; the second issue is that this not having happened automatically seems like a bug.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: After deleting snapshot, still have differencing image and extra disk space usage

Post by socratis »

Open Command Prompt. Post the output of the following sequence of commands. The first one is simply to make the subsequent ones smaller:
  • cd "C:\Program Files\Oracle\VirtualBox\"
    VBoxManage showhdinfo {3c059992-1df8-485c-ac62-93515e8262fb}
    VBoxManage showhdinfo {dca7b9ce-af7a-4e65-a656-4d62c8bb44b4}
    VBoxManage showhdinfo P:\Ubuntu-VM-recovery\Ubuntu.vdi
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.
jimrandomh
Posts: 5
Joined: 21. Feb 2017, 21:25

Re: After deleting snapshot, still have differencing image and extra disk space usage

Post by jimrandomh »

Code: Select all

[jbabcock@dathron VirtualBox]$ ./VBoxManage.exe showhdinfo '{3c059992-1df8-485c-ac62-93515e8262fb}'
UUID:           3c059992-1df8-485c-ac62-93515e8262fb
Parent UUID:    base
State:          locked read
Type:           normal (base)
Location:       D:\Ubicron.vdi
Storage format: VDI
Format variant: dynamic default
Capacity:       131072 MBytes
Size on disk:   121740 MBytes
Encryption:     disabled
Child UUIDs:    dca7b9ce-af7a-4e65-a656-4d62c8bb44b4
[jbabcock@dathron VirtualBox]$ ./VBoxManage.exe showhdinfo '{dca7b9ce-af7a-4e65-a656-4d62c8bb44b4}'
UUID:           dca7b9ce-af7a-4e65-a656-4d62c8bb44b4
Parent UUID:    3c059992-1df8-485c-ac62-93515e8262fb
State:          locked write
Type:           normal (differencing)
Auto-Reset:     off
Location:       C:\Users\jbabcock\VirtualBox VMs\Ubicron\Snapshots\{dca7b9ce-af7a-4e65-a656-4d62c8bb44b4}.vdi
Storage format: VDI
Format variant: differencing default
Capacity:       131072 MBytes
Size on disk:   20358 MBytes
Encryption:     disabled
In use by VMs:  Ubicron (UUID: c87d7d7e-003d-4019-829f-5a7fd2d55741)
[jbabcock@dathron VirtualBox]$ ./VBoxManage.exe showhdinfo 'P:\Ubuntu-VM-recovery\Ubuntu.vdi'
UUID:           03d553dd-eb85-4905-ba46-264766d2bf94
Parent UUID:    base
State:          inaccessible
Access Error:   Could not open the medium 'P:\Ubuntu-VM-recovery\Ubuntu.vdi'.
VD: error VERR_PATH_NOT_FOUND opening image file 'P:\Ubuntu-VM-recovery\Ubuntu.vdi' (VERR_PATH_NOT_FOUND)
Type:           normal (base)
Location:       P:\Ubuntu-VM-recovery\Ubuntu.vdi
Storage format: VDI
Format variant: dynamic default
Capacity:       131072 MBytes
Size on disk:   128643 MBytes
Encryption:     disabled
The third image was on a USB HDD which is not currently mounted, so the path-not-found error is correct. I do not believe it was attached to the VM or the USB HDD mounted at the time the snapshot was deleted; could this be relevant to it not merging the differencing image then?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: After deleting snapshot, still have differencing image and extra disk space usage

Post by socratis »

No problem with the VDI located in P:\, I just thought of asking because it appears in the VBOX file.

Now, for the remaining two. For the sake of keeping things short, I'll be calling the {3c059992-1df8-485c-ac62-93515e8262fb} as "A" and the {dca7b9ce-af7a-4e65-a656-4d62c8bb44b4} as "B". What that information shows is that:
  • A has B as a child snapshot, that much is clear. A: base, B: differencing. A parent UUID: base, B parent UUID: A.
  • Both A and B are dynamic 128 GB capacity. Still, we're doing fine.
  • Here's the funny part that I can't remember seeing before or being able to recreate; the "State" of A and B. A: locked-read, B: locked-write. I don't even have a clue what that may mean or how you ended up like that. I feel there's a piece of the puzzle missing.
I'd wait for a second opinion, but it looks to me that you have two options: 1) clone the VM or 2) clone and merge the VDIs.

Cloning the VM is easy from within VirtualBox itself. Just right-click on the VM, Clone, Full Clone, Current machine state. This will merge your VDIs, but it will assign new UUIDs to the machine and its hard disk. The latter may be problematic if you have GRUB boot your guest based on the HD UUID.

The second option (cloning the VDIs only) uses the tool CloneVDI to merge A and B:
  1. Release the HD from the VM.
  2. Put both VDIs in the same folder.
  3. Select the snapshot | B | {dca7b9ce-af7a-4e65-a656-4d62c8bb44b4} in CloneVDI and clone the whole thing.
  4. Keep the same UUID for the output VDI. It will merge both files into one.
  5. Mind you that since CloneVDI does not touch the originals (except read them), you'll need an extra 128GB available where your output VDI will be.
  6. You then take the "finished product", move it in your VM's folder and attach it to your VM. Done.
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.
Post Reply