Search This Blog

Thursday, January 8, 2015

Resize a VirtualBox VDI Image

I recently wanted to hone my woodworking skills, not in the workshop, but in the planning phase.  My previous projects have all been either "plan as you go" or, at the very best, drawn out and dimensionalized on paper using straight-edges, etc.  As I am not a skilled craftsman, but a mere hobbyist, my projects never seemed to come out how I envisioned them in my head (read: mortise and tenon joints ended up being screwed together).  Anyways, I've known about Sketchup for a while, previously made by Google and now by Trimble, and decided to give it a whirl.  The only problem: for Windows and Mac only.  Of course.  I then set out on a path of finding an alternate, but the community support on YouTube is just phenomenal (search for Sketchup for Woodworking, and you'll see what I mean).

I installed VirtualBox, got Windows 7 up and running, and of course installed all of the updates, Comodo anti-virus, and Firefox.  Bare minimal installation.  Then I installed Sketchup and went to work.  Hours of watching and pausing YouTube, repeating the process in Sketchup, and I'm starting to get excited about the prospect of having actual, real dimensions printed out with my woodworking plans in multiple views, angles, etc.

Tenons for a mobile planer cart

The planer cart

Sander caddy with paper storage

Next up: Windows strikes again and is running out of space.

Out of space!

How is that even possible?  I dynamically allocated 25GB on my hard drive just for Windows.  It's a very minimal installation, yet here I am with a red bar below my C:\ drive, and it stating I have 941MB left of my initial 25GB.  Seriously?  I am reminded once again why I switched years ago to Linux.

  1. Shut down Windows
  2. Close VirtualBox
  3. terminal:
    1. sudo VBoxManage modifyhd "/path/to/vdi/Windows 7.vdi" --resize <size in MB>
    2. In my case: sudo VBoxManage modifyhd "/mnt/Media/VBox/Windows 7.vdi" --resize 30000
    3. Note: the quotes are only required if there is a space in the path (or use the \ modifier, whatever suits you best).
  4. Open VirtualBox, but don't start Windows just yet
  5. Right Click the Windows instance > Settings
  6. Go to Storage in the left pane and click on your VDI file
  7. Verify the Virtual Size is what you requested
  8. Close out of settings and start Windows
  9. Since Windows won't automatically add the new space to your drive, open Disk Management (Control Panel > Administrative Tools > Create and Format hard disk partitions
  10. Right click on your Windows volume > Extend Volume
    Right click on Windows Volume
  11. Next
  12. Change options as you see fit.  I left everything as-is, because I want all 5GB additional space allocated to this volume.
    Extend Volume by preferred amount or leave as-is
  13. Next > Finish
  14. Your Disk Management should now show that you have increased the size of your Windows volume
    Disk Management shows increased size
  15. Open Windows Explorer and verify your hard drive now shows your new storage space
    1. For me, it still showed the old amount because I was in the My Computer view before resizing.  If this is your case, simply click on some other place in Windows Explorer, and go back to Computer view and it should update.
And Wa La!  Back to the happy blue color.

I hope this helps out someone.  If you run into problems, review the documentation.  While researching, I ran across a post on the Ubuntu forums that if it is a fixed disk instead of dynamically allocated - meaning your original VDI file was the full size of the disk instead of gradually growing as needed over time - this process will not work.  There is, however, a VirtualBox utility out there that will supposedly copy your fixed VDI file to a dynamic one while resizing it.  I believe it is a Windows utility so I didn't pay much attention to it.

Good luck, and if there are any discrepancies please let me know in the comments.

No comments:

Post a Comment