Changing VirtualBox’s Disk Image Sizes

I was running out of room in my Virtual Box Windows 7 disk.  Windows was reporting used space of 18.6 GB and free space of 1.22 GB.  My Mac was reporting that my disk image was using up 21.39 GB.

Compacting

On your Windows Guest:

  1. Run Disk Cleanup.
  2. Run Disk Defragmenter.
  3. Download SDelete and use it to zero out free space. I put sdelete in C:\Windows\System32 and then ran it like this from the command prompt.
    C:\> sdelete -c c:/

  4. Shutdown Windows.

On your Mac Host:

  1. Run VBoxManage from the Terminal to compact the disk image.
    $ VBoxManage modifyhd Windows.vdi --compact

Sad Story

I first tried shrinking the disk image to see if that would free up room using the instructions above which were based on the article How To Shrink Your Virtualbox VM And Free Up Space For Your Hard Disk.

After doing this Windows reported used space of 18.8 GB and free space of 1.03 GB.  In other words no difference. Sad smile  But on the Mac the disk image was now only using up 20.51 GB.

Resizing

On your Windows Guest:

  1. Shutdown Windows.

On your Mac Host:

  1. Run VBoxManage from the Terminal to resize the disk image. This is how I did it.
    $ VBoxManage modifyhd Windows.vdi --resize N

On your Windows Guest:

  1. Restart Windows.
  2. Use diskpart to resize the C: drive to use the new space.

Happy Story

Realizing that compacting did not work I shut down again and this time increased the size of the disk image by 10 GB from 20 GB to 30 GB (N = 30720).

VirtualBox showed in its settings that the disk image size was now 30 GB.  But Windows still reported used space of 18.8 GB and free space of 1.03 GB.  Again no difference. Sad smile  And on the Mac the disk image was still the same but that was to be expected.

Back to Google which led me to Windows’ brilliant tool diskpart.

C:\>diskpart

Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: WIN-7-IMAC-POOP

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D   VBOXADDITIO  CDFS   CD-ROM        38 MB  Healthy
  Volume 1         System Rese  NTFS   Partition    100 MB  Healthy    System
  Volume 2     C                NTFS   Partition     19 GB  Healthy    Boot

DISKPART> select volume 2

Volume 2 is the selected volume.

DISKPART> extend size=10240

DiskPart successfully extended the volume.

Windows now reported free space of 11.0 GB.Open-mouthed smile

End Note

I originally tried resizing the disk by specifying the size of how much I wanted the disk increased, i.e. 10 GB or N=10240.

$ VBoxManage modifyhd Library/VirtualBox/HardDisks/Windows\ 7.vdi --resize 10240

This failed with the strange error:

Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

Fortunately I found out in one of the VirtualBox forums that this happened because I gave the wrong argument to resize.  Too bad the error message wasn’t a little more helpful. Smile

VirtualBox Unable to Run Two Instances

Double Bows by Nicholas_T

I have been using VirtualBox for awhile and have been pretty pleased with it considering it’s a free solution.  I blogged about wanting to try it over two years ago.

Today I started up Windows 7 on my iMac.  Then I tried to start up Windows XP but got this error.

Failed to open a session for the virtual machine Windows XP Pro Media Center.

PIIX3 cannot attach drive to the Secondary Master
(VERR_SHARING_VOILATION).

Unknown error creating VM (VERR_SHARING_VIOLATION).

Fortunately Google came to the rescue and led me to this article in the VirtualBox forums, Can’t run multiple Instances on OSX Leapord.  Once I unmounted the DVD drive in Windows 7 (Devices –> CD/DVD Devices) I was able to start Windows XP.

The lesson is you can’t run two instances if both want to mount the same DVD drive. Not sure if this is a problem with Parallels or VMWare.

Mac Hibernate

I tried to make the Mac hibernate based on this article, Make my Macbook Pro Hibernate. Unfortunately it did not work and I am wondering if it is because this article is older and maybe it does not work for Mac OS X Leopard.

In the end I have gotten used to not having hibernate on the Mac since start up and shutdown are so fast.

Microsoft Office 2008 update 12.1.0 will not install

I tried many times to install the Microsoft Office 2008 update 12.1.0 but each time it would hang.

Finally I found this forum thread about the exact same problem, Msi Wind Forums • View topic – Microsoft Office 2008 update 12.1.0 will not install.

This is how to get the update to install.

Should have an option to edit……thing is it’s to late because your forced quit. Run the installer again and when the installer hangs move the installer window to one side…the error window noted above should be directly behind the installer and thats why you missed it in the first place…the installer has halted (and appears hung) as the error window is awaiting a response from you…..but you dont see it. All you have to do is click the edit button on the error window and then installer will continue…thats it. You can close the error window and the installer will continue.

Maintaining your Mac

Macworld has a series of articles that I found helpful on maintaining your mac.

  1. Essential Mac Maintenance: Get set up

    Perhaps the most important component to test is RAM…  Thankfully, it’s not difficult to do so, although a comprehensive test can take a while. Apple Hardware Test, included on the Mac OS X Install disc that comes with all recent Macs, has an Extended Testing option that tests your RAM.

  2. Essential Mac Maintenance: Rev Up Your Routines
  3. Five Maintenance Myths

    Myth #2: “You need to run the Unix maintenance scripts.”
    You may have heard about a collection of magical Unix maintenance scripts that OS X is supposed to run automatically. The story goes that because these scripts are scheduled to run in the middle of the night, putting your Mac to sleep or shutting it down prevents them from running—so you need to do so manually…

    An easy way to run the scripts manually is by using Mike Vande Ven Jr.’s free Maintidget 1.3, a Dashboard widget that shows you the last time each script was run and lets you manually run one or all with a single click. There are also innumerable tweaking utilities that provide similar functionality

Display Date in OS X Menu Bar

On November 23rd I ordered my first Mac laptop since my Powerbook in grad school, a white Macbook. 2.2 GHz Intel Core 2 Duo. So far I’ve been reasonably impressed but one thing I wanted is for the menu bar to display the full date. It always bothered me that you can’t do this on Windows w/o third party applications.Fortunately on Mac OS X there is somewhat of a hack to do this, How To: Display Date in OS X Menu Bar.The format I ended up choosing is:Thu Jan 10 7:07 PMwhich I think is a little cleaner than the one used in the aforementioned article.Update: As of March 19, 2008, this cute hack no longer seems to work.  Seems like one of the Mac OS X updates changed the way the date is displayed in the OS X menu bar.  Now my date looks like this:Wed 9:23 AM PDT