VirtualBox: Snapshots filling up disk, what to do

So this has happened to me again. I didn’t pay attention to VirtualBox snapshots filling up my „vm“ partition. Yesterday, less than 2 GB were left, so I eventually thought of deleting snapshots.

vbox-snapshotsIn VirtualBox (VBox), deleting a snapshot means merging it with the originally created virtual disk image (VDI) file (in my case, Suse13.vdi). But that works only if there’s enough space on the partition for that operation. As I found, to merge a 10 GB snapshot file into a 15 GB original VDI file, you need at least 5 GB free space for the temporary files that VBox creates. Unfortunately, there’s no way to instruct VBox to use space on another partition for those temporary files.

What I found after a lot of googling was that most people revert to cloning the virtual machine (VM), then discarding the original VM (that is, deleting the original VDI file and all the snapshot files), then creating a new VM using the cloned VDI. Similar problem here, since there’s no way to tell VBox to create the VDI clone on a different partition, you’re stuck when there’s not enough space on your disk. For that reason, you can’t use the graphical VBox interface, but you can use the command-line interface. On Linux, that would be a command like this:

vboxmanage clonevdi linux/Suse13.vdi /mnt/goobay1/Suse13clone.vdi

For me, that created a VDI clone on another partition — so far, so good. Unfortunately, that clone wouldn’t boot. Not sure if that could be fixed — I gave up fiddling to get it working after half an hour.

Eventually, I found a solution on the Net that was too obvious to find out myself: Simply move the snapshot files to another partition, create symbolic links in the original location, then merge the snapshot files. D’uh. It goes like this (on Unix-style operating systems):

(1) Find where the snapshot files are. They’re normally near your VDI file, in a folder called Snapshots.

(2) Move the snapshot files with commands like this:

Atlas/vm/linux/Suse13/Snapshots> mv {eadb26a3-df2b-4481-be35-abbc5fdc27a4}.vdi /mnt/goobay1/MyLinuxSnapshotsNew/

(3) Create symbolic links:

Atlas/vm/linux/Suse13/Snapshots> ln -s /mnt/goobay1/MyLinuxSnapshotsNew/\{eadb26a3-df2b-4481-be35-abbc5fdc27a4\}.vdi .

In the example above, that „shrunk“ the file size from 9 GB to 75 bytes, thus freeing up 9 GB on the VM’s partition. I did likewise for another snapshot file, which together freed up 25 GB, more than enough to eventually delete (merge) the snapshot files. (After a successful merge, VBox will delete what it thinks is the snapshot file, but that’s actually the symbolic link. To free up space on your „remote“ partition, you’ll then manually have to delete the snapshot file.)

Important: Make sure your VM is shut down properly. Don’t suspend it or even leave it running!

Important: Before deleting (merging) the snapshots from the VBox graphical interface, make sure your VM is happy with the symbolic links, and still starts up. If it doesn’t, you can still remove the symbolic link, and move back the original snapshot file. (This won’t solve the problem of not having enough disk space, but at least it will leave your VM working.) Starting up the VM when one or more snapshot files are on a „remote“ partition may take a little longer than usual; don’t worry, that’s expected.

Takeaway: Don’t use VBox snapshots, unless you know what you’re doing (which I obviously didn’t). From now, what I do is to simply copy the VDI file from time to time, which gives me a backup in case the VDI file gets borked for some reason.

Good luck!

XSane: Konnte Scanner nicht starten — ungültiges Argument

Wollte heute Morgen mein frisches Foto für den Reisepass scannen. Vorschauscan funktionierte, Scannen nicht. XSane meldete:

Konnte Scanner nicht starten — ungültiges Argument.

Googeln erbrachte überwiegend die Empfehlung, den Ordner ~/.sane zu löschen und es noch mal zu probieren. Das funktionierte ebenfalls nicht.

Der wirkliche Grund scheint ein anderer zu sein: Das Passbild ist einfach zu klein. XSane mag es anscheinend nicht, wenn man nur 3,39 x 4,27 cm scannt. Erst wenn beide Werte (Höhe und Breite) etwa 5 cm betragen, zickt XSane nicht mehr rum, sondern scannt brav wie immer schon.

Meine Konfiguration (obwohl diese wahrscheinlich keine Rolle spielt): XSane 0.998 gestartet aus dem grafischen Tool HP Linux Imaging and Printing (HPLIP) 3.13.10 unter openSuse 13.1. Der Drucker/Kopierer/Scanner ist ein HP LaserJet 200 color MFP M276nw, sehr ordentliches Gerät übrigens.