Resizing virtual disks

You have have:

  • installed virtualization software e.g. VirtualBox on your native, host machine e.g. OSX
  • created a virtual machine on your host machine
  • installed an OS (guest e.g. Windows) on the virtual machine
  • proceeded to use the virtual machine, and filled up it’s disk !!!!

Don’t make this mistake: scrimp on virtual disks

When you create a virtual machine you choose a maximum size for its virtual disk.  Don’t scrimp. You are choosing a limit, and it doesn’t immediately use that space on your host machine (if the virtual disk is dynamically allocated.)  But it does fix the size that the guest machine will use.  Then when you install the guest OS, it creates a partition and file system on that size of disk.  (But it only uses, i.e. dynamically allocates, blocks on the host that have been written to by the guest.)  The dynamic allocation refers to the host.(The guest dynamically fills the disk, and that must also involve ‘allocation’ but that’s another thing.)

(If you make a virtual disk very large (as large as the real disk on the host), then when a guest fills up the disk, any ‘disk full’ problems will manifest themselves in the host first.)

If you make a virtual disk too small, when the guest fills it up, ‘disk full’ problems manifest themselves on the guest (even though the host may have plenty of disk space left.)

An Example

I created a Windows virtual machine with only a 25G virtual disk.  My purpose for the machine is software development.  By the time I installed Windows, Dropbox, Cygwin, and Qt, the disk was already full.

Solutions

Possible solutions:

  • struggle by careful managment of what you install and delete (tedious and fraught with error)
  • discard the virtual machine and start over (not pleasant if you have installed much software on the guest.)
  • resize the virtual disk (enlarging it.)

Instructions for resizing a virtual disk

Here are nice instructions for resizing a virtual disk, for the case where:

  • host is Windows
  • guest is Windows
  • virtualization software is VirtualBox OR VMWare
  • GParted is used as a LiveCD for repartioning

You can adapt the instructions for other cases.

One interesting aspect is: you temporarily boot the guest machine (usually running Windows) with a LiveCD (running Linux? and including GParted) so that you can repartition the disk that the guest Windows will see.  (As discussed, you can’t repartition the Windows C: disk while Windows is running.)

It can get confusing very fast.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s