Extending Windows C: Drive using VirtualBox and iSCSI with FreeNAS
Previously I described how to use VirtualBox to set up a Windows VM with storage on a FreeNAS (courtesy iSCSI). To rehash very briefly, it’s straightforward: from FreeNAS, create a zvol and export it via iSCSI. On your virtual machine host, drop to the command line to create a virtual hard drive based on that iSCSI target. This post assumes you’re familiar with that process.
I did just that earlier this year, and the results - even without intense performance tuning - were impressive on my Gbps LAN. At the time, I created a 50GiB zvol for the purpose, which was more than enough for a host that I use maybe once per week for an hour at a time. Now, I’ll be using it more frequently, and 50GiB just isn’t enough anymore. What to do? It’s surprisingly simple.
Be sure to power off your Windows VM before getting started.
Step 1: Upgrade your zvol
In the FreeNAS Web GUI, “Edit” your zvol, and change the size.
Step 2: Resize your C: Drive in Windows
1. Boot Windows.
2. From the “Start” menu, right click “Computer” and click “Manage”
3. Click “Disk Management”
You should see the “C:” drive followed by your new extra drive space. Right click on the “C:” drive, choose “Extend Volume…” and follow the wizard (which in my case was a simple “Next”-Fest).
Step 3: Profit
I was surprised that VirtualBox automatically picked up the new block device size. The volume extension process was near-instantaneous for me, and all that fresh storage space was immediately available for consumption. Couldn’t have been any easier.