Resizing a VirtualBox virtual disk

I’m in the process of putting together a VirtualBox virtual machine for me and my co-workers to use so we can access our Outlook email accounts without rebooting into Windows and so that the web developers can test the pages they work on in IE.

Things were going well with VirtualBox until I realized I didn’t make the size of the disk large enough. I had it set at 5GB, thinking that’d be enough for what we need it for, but apparently not.  So I wanted to figure out how to resize the disk without having to go through creating an entirely new one and having to sit through the installation process all over again. I found this post in the VirtualBox forum about it and followed those directions and elaborating on them with some lovely screenshots.

  1. The first thing you want to do is create a new disk like you would if you were starting over.  File -> Virtual Media Manage -> under Hard Disks click new.  I’ll avoid explaining that process since I’m assuming you already know it if you’re looking to resize it.
  2. Download System Rescue CD.
  3. The next thing you want to do is set it so that the new disk you created is attached to your current virtual machine and change it so the System Rescue CD iso file is mounted.  See the screenshots below:
    For the CD click the little button next to the drop down list.
    Click the add button, and go to wherever you saved the .iso file.
    Press select and you’re done with this part.
  4. Now start the virtual machine and boot it to the CD you mounted.  You have to hit enter a couple times, but once you’re prompted type in startx and hit enter.
  5. When the terminal pops up type in gparted and hit enter.
  6. Right-click on your ntfs partition and click copy, then select the 2nd disk you created and paste over it.
    gparted 2nd HD
    paste old over new
  7. When it prompts you for the size of the disk make sure to pull the arrow all the way over to the right so that the free space following says zero and click paste.resize
  8. Once you tell it to apply the changes it will take awhile so I suggest getting up and going to do something else.  I left work and came back in today to finish this up.  I have no idea how long it took.
  9. When it is finished you need to tell it to use the new disk as the boot partition.  To do that right-click on it and go to manage flags and check the boot box then close it.
  10. Now all you have to do is close out gparted and shut down the virtual machine and change some of the settings from step 3.

After shutting it down what you want to do is go back to step 3 to make your larger HD the primary master, remove (and delete to get that hard drive space back) the old one, and change it back so that you are using the CD drive and not booting off the rescue CD anymore.  I wanted my space back since I wasn’t going to be using that smaller one.

, , ,

  1. #1 by onumutt on March 24, 2011 - 3:10 PM

    Thx, Gparted showed error messages,1) when I copied original partition and 2) when I rebooted and resized this partition. Still, new XP controlled NTFS file system and after that booted like charm.

  2. #2 by B man on January 1, 2010 - 12:08 PM

    I just tried this with a windows 7 vm. It worked very well but the boot loader freaked a little bit on the first boot of the “new” drive. I loaded an image of the win 7 install and ran a repair and viola! It worked perfectly.

  3. #3 by Michael on December 21, 2009 - 5:53 PM

    This worked like a charm. Windows XP ran a chkdsk when it booted the first time after the copy, then all was back to normal (except for a bigger “disk”).

  4. #4 by q11q11 on October 9, 2009 - 7:30 AM

    truly helped me, but i used slitaz to run gparted, 5gb->16Gb took 20-25 minutes on 2Ghz+1Gb-ram

  5. #5 by DanB on June 23, 2009 - 1:30 PM

    This worked great on vb 2.14 OSE.
    Thanks much

  6. #6 by josteint on April 28, 2009 - 6:02 AM

    brilliant! this helped a lot and was very easy to follow. thank you 🙂

  7. #7 by silentblue on April 27, 2009 - 5:11 AM

    your method works perfectly. excellent effort. thank you.

  8. #8 by Elias Hickman on March 12, 2009 - 12:08 AM

    Nice. Thanks for the screenshots. Worked like a charm. 🙂

  9. #9 by Anonymous on March 3, 2009 - 8:25 AM

    Good idea…

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

%d bloggers like this: