SEARCH

How-To Geek

How To Enlarge a Virtual Machine’s Disk in VirtualBox or VMware

image

When you create a virtual hard disk in VirtualBox or VMware, you specify a maximum disk size. If you want more space on your virtual machine’s hard disk later, you’ll have to enlarge the virtual hard disk and partition.

Note that you may want to back up your virtual hard disk file before performing these operations – there’s always a chance something can go wrong, so it’s always good to have backups. However, the process worked fine for us.

Image Credit: flickrsven

Enlarge a Virtual Disk in VirtualBox

To enlarge a virtual disk in VirtualBox, you’ll need to use the VBoxManage command from a Command Prompt window. First, shut down the virtual machine – ensure its state is set to Powered Off, not Saved.

image

Second, open a Command Prompt window from your Start menu and change to VirtualBox’s program files folder so you can run the command:

cd “C:\Program Files\Oracle\VirtualBox”

image

The following command will operate on the VirtualBox virtual disk located at “C:\Users\Chris\VirtualBox VMs\Windows 7\Windows 7.vdi”. It will resize the virtual disk to 81920 MB (80 GB).

VBoxManage modifyhd “C:\Users\Chris\VirtualBox VMs\Windows 7\Windows 7.vdi” –resize 81920

(Use two dashes before resize in the command above.)

Replace the file path in the command above with the location of the VirtualBox disk you want to resize and the number with the size you want to enlarge the image to (in MB).

image

Note that this process doesn’t enlarge the partition on the virtual hard disk, so you won’t have access to the new space yet – see the Enlarge the Virtual Machine’s Partition section below for more information.

Enlarge a Virtual Disk in VMware

To enlarge a virtual machine’s hard disk in VMware, power off the virtual machine, right-click it, and select Virtual Machine Settings.

image

Select the virtual hard disk device in the list, click the Utilities button, and click Expand to expand the hard disk.

image

Enter a larger maximum disk size and click the Expand button. VMware will increase the size of your virtual disk, although its partitions will remain the same size – see below for information on enlarging the partition.

image

Enlarge the Virtual Machine’s Partition

You now have a larger virtual hard disk. However, the operating system’s partition on your virtual hard disk is the same size, so you won’t be able to access any of this space yet.

image

You’ll now need to extend the guest operating system’s partition as if you were enlarging a partition on a real hard disk in a physical computer. You can’t enlarge the partition while the guest operating system is running, just as you can’t enlarge your C:\ partition while Windows is running on your computer.

You can use a GParted live CD to resize your virtual machine’s partition – simply boot the GParted ISO image in your virtual machine and you’ll be taken to the GParted partition editor in a live Linux environment. GParted will be able to enlarge the partition on the virtual hard disk.

First, download the GParted live CD’s ISO file from here.

Load the ISO file into your virtual machine by going into the virtual machine’s settings window, selecting your virtual CD drive, and browsing to the ISO file on your computer.

image

Boot (or restart) your virtual machine after inserting the ISO image and the virtual machine will boot from the ISO image. GParted’s live CD will ask you several questions while booting – you can press Enter to skip them for the default options.

Once GParted is booted, right-click the partition you want to enlarge and select Resize/Move.

image

Specify a new size for the partition – for example, drag the slider all the way to the right to use all the available space for the partition. Click the Resize/Move button after you’ve specified the space you want to use.

image

Finally, click the Apply button to apply your changes and enlarge the partition.

image

After the resize operation completes, restart your virtual machine and remove the GParted ISO file. Windows will check the file system in your virtual machine to ensure it’s working properly — don’t interrupt this check.

image

The virtual machine’s partition will now take up the entire virtual hard disk, so you’ll have access to the additional space.


Note that there are easier ways to get more storage – you can add a second virtual hard disk to your virtual machine from its settings window. You can access the other hard disk’s contents on a separate partition – for example, if you’re using a Windows virtual machine, the other virtual hard disk will be accessible at a different drive letter inside your virtual machine.

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.

  • Published 09/16/12

Comments (6)

  1. Venky

    Hi Chris Hoffman,

    Impressive articles – Very good.

    With Regards
    Venky

  2. bobo42813

    To bad this VM Junk doesn’t work on Linux Ubuntu 12.4 LTS.

    Have fun,
    Bob

  3. Dave

    Nice article but I think I’ll go back to vacuum tubes. At least I understood and could see them. Gonna have to read this a couple of times to understand it. DUH!

  4. r

    …good 2 know

  5. Tony

    bobo42813, what problem are you having with using this in Ubuntu 12.04? Is Ubuntu running as the host, or as the virtual machine? Please tell us what steps you’ve tried and what problems you’ve run into, being as specific as you can, and we’ll see if we can figure it out.
    Tony

  6. bobby_tables

    You should just be able to extend the volume inside of disk management. So you shouldn’t need a third party utility to expand or shrink the partition in Windows 7/Vista or higher.

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!