Resize partition of Windows 7 running on VirtualBox with dynamically allocated storage

23

5

I run Windows 7 inside VirtualBox.

I resized the disk of Windows 7 from 25 GB to 50 GB:

VBoxManage modifyhd Windows\ 7\ Pro.vdi --resize 50000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

VirtualBox size

PROBLEM: I can' grow the partition, neither with Windows 7 itself nor with GParted:

Disk management

GParted

It looks like VirtualBox does not tell the client OS about the new size.
What additional step is necessary?

Nicolas Raoul

Posted 2012-09-03T09:41:06.643

Reputation: 7 766

1The command line tool worked for me. I could then extend the partition inside in Windows. – Damian – 2017-12-19T07:53:34.307

there shouldn't be anything else required, although I have had better luck with gparted than right in windows. does your VM with that disk have any snapshots? resizing does not support disks with snapshots. – Ryan_S – 2012-09-17T21:12:28.110

Answers

27

You can only resize disks if they are not part of a VM that uses snapshots.

If you are using snapshots, you can easily clone the state to a new VM and hard disk, and resize that one. VirtualBox 4 now supports cloning from the GUI, so it's super easy.

VBoxManage - modifyhd

Here's a helpful walk through of the whole process, Resize and Expand a Virtualbox Hard Drive and Media in 4 Steps

Ryan_S

Posted 2012-09-03T09:41:06.643

Reputation: 624

1as Ryan said, my VM had snapshots and I couldn't extend the partition in Windows. I ended up cloning the VM (not just the disk). See command "vboxmanage clonevm". The clone contained only the current state (no snapshots), so I was able to extend the partition. – dalf – 2017-04-17T02:09:41.123

That works! Note: After cloning and resizing the disk, open the VM's settings, remove the former disk and add the new one. – Nicolas Raoul – 2017-10-06T06:46:17.233

Also it seems to not be available for VMDK disk images – golimar – 2018-11-06T10:17:41.237

0

For Windows host:

#command - give Windows direct path in order to use vboxmanage in any folder directly
PATH=%PATH%;C:\Program Files\Oracle\VirtualBox
#command - resize vdi, size in MB (75GB below), go to vdi folder first
VBoxmanage modifyhd [%vdiname].vdi --resize 75000
#comment - for Windows VM use some tool, e.g., partitionwizard free, to resize inside VM, profit

This is what I use, and it works for me.

nomotakon

Posted 2012-09-03T09:41:06.643

Reputation: 1