I use VirtualBox on my main machine to effectively run 2 operating systems. Today I was installing some new software and filled my program drive. This is a 128 GB sold-state drive and I hadn't been playing attention to how much free space was available. I store the main hard drives for VirtualBox on an other drive, but it turns out VirtualBox was saving snapshots on this drive, and had consumed 40 GB of that space. So when I went to install Android Studio for an upcoming project, I filled the disk. That usually isn't an issue—move stuff around and try again. Not today.
I had an instance of VirtualBox open when I ran out of space. What I discovered is that when you close VirtualBox, it saves its configuration. But when there is no space, it simply creates a file of 0 size. Then when you try and start VirtualBox it complains the configuration is corrupt—which it now is. You have now also lost all virtual configurations.
Many of my virtual machines were easy to get back. But the one that I run primarily as my second OS had a snapshot. Because of the snapshot I couldn't simply restore the VM. It took a lot of trial and error before I figured out something that worked.
The VirtualBox configuration file is XML. It assigns virtual drives UUIDs. When I lost the configuration file, I lost the association between the virtual drive file name and its UUID. Lucky for me, I happened to have an old configuration file with some of the associations. But that didn't help me restore the VM I needed. The problem was this VM had a snapshot. I had the virtual drive, and the snapshot, but I needed to link them somehow.
After some playing around, I understood the above format. What we have is a drive called root.vdi that has been assigned the UUID ff89a8e5-aeba-49bf-a37b-1c784270913b. It has a single snapshot called 8f4500a5-cb4a-4528-a3d7-d2d0fe9226a9}.vdi with the UUID of the same value. When I figured this out I thought I was good to go. But it turns out that in my playing around I messed up the snapshot and it no longer was assigned the correct UUID. Somehow the UUID was reassigned to all zero.
More searching around I came across the program VboxManage. This comes with VirtualBox and allows the UUID of a drive to be set/changed.
VBoxManage internalcommands setvdiuuid <disk.vdi>
That seemed to set the UUID of the root drive alright, but the snapshot was still complaining. After looking at the command I saw this was changing the UUID of the drive, but said nothing about the parent of the drive. I found an other internal command, sethdparentuuid. This is what I was looking for.
VBoxManage internalcommands sethdparentuuid <snapshot.vdi>
After I did this, my snapshot booted up and I was back in buisness. Only took about 2 hours.
In hindsite I see I made a mistake. VirtualBox creates a file called VirtualBox.xml-prev when it closes. That would have contained my old configuration. Unfortunately I didn't know this when I removed the corrupt version and tried to start the program. That file would have contained my entire configuration, but was overwritten after VirtualBox closed a second time.
The evenings skating session started off like the last couple of week. When I arrived the parking lot of close to full, and I was pretty sure I wasn't going to be get my speeds up. But this time at the 7:30 mark when the afternoon session ends the rink cleared out enough that I could skate at my standard speeds. I found I was holding a heart rate of 190 BPM (103.8% max) and while this clearly took effort, I felt good. Managed to push my heart rate up to 193 BPM (105.4% max) which ties my previous record. Most of the night I was able to hold heart rates of 180 BPM or more (98%), even for the last couple songs of the session. I burned through the first 1,000 Calories in about an hour and 10 minutes. My heart rate monitor stopped at some point and I lost around 10 minutes of data. Like that last time it lost the signal, it required me to stop the session and start a new one. When I did everything worked fine. The total floor time: 3 hours and 1 minute logged with 2,674 Calories burned. Average heart rate was 163.5 BPM. The Calories burned and average heart rate are new records, and the maximum heart rate ties for record. It wasn't until I tried to take my skates off I realized I was fairly sore.
All of this makes me want more data about my skating sessions. I'm looking into methods for monitoring rotational speed of my skate wheels. The Digispark is a tiny microcontroller board, and this with an IR sensor should allow me to wheel speed. What to do with this information is the question. I found a real-time clock that contains non-volatile memory. So I could timestamp the data and log it. I could also investigate using a Bluetooth board and transmitting the data to my phone. The nice thing about using my phone is I have plenty of storage and tons of horsepower for number crunching. At some point I am going to have to try my heart rate monitor again because ultimately I want to correlate speed and heart rate. I also want much more detail from my heart information such as heart rate over the entire session time, and a chart denoting how much time was spent at various rates. To be able to match heart rate and wheel speed I can also check the delay between when I begin to push hard and how long it takes me heart to respond. And the reverse information is even more important: after I stop pushing hard, how long does it take my heart to slow down. This is easy to do once I have the data, and I need to build a better device to get that data.