# When bugs attack … the case of the ever expanding VirtualBox image

So I’ve got a Mac Mini and a Linux machine on my desk at work. I am trying hard to use the Mac Mini for day to day stuff, but the sheer broken-ness of the keyboard (yes, really) for Mac’s is driving me near batty. I am trying though. (Hint to Apple: You aren’t better at everything, and most especially not keyboards and interfacing to higher quality Logitech keyboards, you almost completely fail … don’t even get me started on mice …).
So I need to run VMs for the last vestigates of Windows 7 that we run around here. I don’t want to run Windows. We won’t let windows touch raw hardware for obvious reasons. So its a VM. I’ve been using VirtualBox on Linux for a while, though it almost drove me batty recently. I’ve been using kvm as well, and really want to migrate to a full kvm stack and leave VirtualBox in the past.
But for the moment, moving VMs between virtualization platforms isn’t terribly easy … actually … its effectively impossible with Windows. BSOD very quickly upon boot, and recovery is unpossible. Which is yet another reason to leave windows in the dim and distant past, as soon as possible.
So I have a VirtualBox VM of windows 7. It has the few tools I need (Office, Acrobat). Remember, you can’t actually buy new office for Mac (or PCs). Its office 365 now, and while I did try the 30 day test, it really didn’t work very well. The next CEO of Microsoft is going to have some terribly hard choices about what to turn their company into. But thats for another discussion.
I tried lighting up the VM yesterday after a week break of not using it. The 65GB VM disk had ballooned to 385GB. Weird.
So I copied the whole VM bits onto my trusty Linux desktop box (with 5.1TB of fast RAID6 space). Set up an SMB mount (NFS didn’t do precisely what I wanted here for some reason).
Lit up VirtualBox. A bit slower, but manageable. The computer panel still shows the 65GB drive. Weird.
Then the VM paused with a BLK_IO error of some sort. Ok, shut it down, and lets look at the directory again. Remember, it was about 350GB yesterday.

landman@metal:~\$ sudo -s
root@metal:~# cd /home/neutrino/VirtualBox\ VMs/Windows7/
root@metal:/home/neutrino/VirtualBox VMs/Windows7# ls -alF
total 332254964
drwxr-xr-x 4 landman 1001                  98 Jan  8 10:24 ./
drwxr-xr-x 6 landman 1001                  66 Jan  3  2013 ../
drwx------ 2 landman 1001                  72 Jan  8 10:17 Logs/
drwx------ 2 landman 1001                  47 Jan  8 10:23 Snapshots/
-rwx-w---- 1 landman 1001 3530872686601314304 Jan  8 10:25 Windows7.qcow*
-rwx-w---- 1 landman 1001               13070 Jan  8 10:24 Windows7.vbox*
-rwx-w---- 1 landman 1001               13069 Jan  8 10:24 Windows7.vbox-prev*
root@metal:/home/neutrino/VirtualBox VMs/Windows7#


Wait … what?
Thanks to some bug, somewhere, a nice sparse file has been created. A big sparse file.

root@metal:/home/neutrino/VirtualBox VMs/Windows7# ls -alFh
total 317G
drwxr-xr-x 4 landman 1001   98 Jan  8 10:24 ./
drwxr-xr-x 6 landman 1001   66 Jan  3  2013 ../
drwx------ 2 landman 1001   72 Jan  8 10:17 Logs/
drwx------ 2 landman 1001   47 Jan  8 10:23 Snapshots/
-rwx-w---- 1 landman 1001 3.1E Jan  8 10:25 Windows7.qcow*
-rwx-w---- 1 landman 1001  13K Jan  8 10:24 Windows7.vbox*
-rwx-w---- 1 landman 1001  13K Jan  8 10:24 Windows7.vbox-prev*

Yes folks, a 3.1EB file is sitting there on my 5.1TB file system. Its sparse, so thats ok. Unless you want to, I dunno, work with it?
Its not really 3.1EB.
Oh. No.

root@metal:/home/neutrino/VirtualBox VMs/Windows7# ls -alFhs
total 317G
0 drwxr-xr-x 4 landman 1001   98 Jan  8 10:24 ./
0 drwxr-xr-x 6 landman 1001   66 Jan  3  2013 ../
0 drwx------ 2 landman 1001   72 Jan  8 10:17 Logs/
0 drwx------ 2 landman 1001   47 Jan  8 10:23 Snapshots/
317G -rwx-w---- 1 landman 1001 3.1E Jan  8 10:25 Windows7.qcow*
16K -rwx-w---- 1 landman 1001  13K Jan  8 10:24 Windows7.vbox*
16K -rwx-w---- 1 landman 1001  13K Jan  8 10:24 Windows7.vbox-prev*


But remember, it really isn’t 317GB either. Its 65GB. I know, I created it that large.
So I am going to blow this away. And look and see if I can finally do VDI the right way internally (lack of infrastructure in our case for this, but mebbe its time to build it). We’ve been working on a VDI appliance for a while, and I think its time for our own dog food to be eaten. Enough of this sillyness!