Howto increase hard disk size after installing a guest OS

This is for discussing general topics about how to use VirtualBox.
milan.jaros
Posts: 2
Joined: 21. Jul 2011, 16:45
Primary OS: MS Windows 7
VBox Version: OSE self-compiled
Guest OSses: Win7

Re: Howto increase hard disk size after installing a guest OS

Post by milan.jaros »

Howdy!
Mr. klaus, unfortunately your answer was wrong. 8) I did it this way:
1) Create new disk (e.g. 2TB size) and shutdown VM.
2) Run:

Code: Select all

c:\Program Files\Oracle\VirtualBox\VBoxManage.exe clonehd --existing disk1.vdi new-disk.vdi
3) Un-mount the old one and start VM.
4) Open disk-management tool (in virtual machine's Windows) and extend your existing partition.

Creation of small dynamically allocated disks is mistake of the beginners, like I am. Please, write somewhere into the wizard for disk creation that disk cannot be re-sized in future.

Best regards,
Milan

Edit: clonevdi > clonehd
Last edited by milan.jaros on 22. Jul 2011, 11:33, edited 1 time in total.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Howto increase hard disk size after installing a guest OS

Post by mpack »

milan.jaros wrote:Please, write somewhere into the wizard for disk creation that disk cannot be re-sized in future.
In fact, it turns out that an officially supported command was recently introduced - "VBoxManage modifyhd --resize" - which can modify the size of an existing dynamic VDI, so your suggestion would be inappropriate. Even if you weren't aware of that, my unofficial CloneVDI tool (see sticky in "Windows Hosts") has existed for almost 2 years and can also resize VDIs.

And ps: the "VBoxManage clonevdi" command has been obsolete for at least the last couple of years - I wish people would stop advocating it! The correct command is now "VBoxManage clonehd".
Last edited by mpack on 22. Jul 2011, 14:17, edited 1 time in total.
milan.jaros
Posts: 2
Joined: 21. Jul 2011, 16:45
Primary OS: MS Windows 7
VBox Version: OSE self-compiled
Guest OSses: Win7

Re: Howto increase hard disk size after installing a guest OS

Post by milan.jaros »

This sounds really great. Thx!
low351
Posts: 4
Joined: 1. Sep 2011, 16:13
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Linux

Re: Howto increase hard disk size after installing a guest O

Post by low351 »

I skimmed this and perhaps I missed it, but most of you seemed to be concerned about Windows vms, I had this problem with an Ubuntu vm.

I tried some of the suggestions here but the result was an unbootable vm, most likely due to the grub mbr being left out in the gparted copy.

I finally found a way to do this. :wink:

First I used the CloneVDI utility http://forums.virtualbox.org/viewtopic.php?t=22422 to increase my .vdi disk from 8GB to 40GB.

Don't bother with the "Increase partition size" checkbox, it won't work, you need to use gParted to do it properly.

Then I booted from an .iso of the gParted live cd and increased my partition to fill the space, I also took advantage of this moment to increase my swap partition.

When I restarted my Ubuntu vm it worked except for the swap partition since the /etc/fstab was using the UUID of the partition, even though I'd matched the device name.

I ran "blkid" to see the new one and replaced it in my /etc/fstab, rebooted and everything was fine.
rajendersaini
Posts: 1
Joined: 30. Sep 2011, 16:48
Primary OS: MS Windows 7
VBox Version: OSE Debian
Guest OSses: win7

Re: Howto increase hard disk size after installing a guest O

Post by rajendersaini »

usmanaziz wrote:Hi, I created a hard disk with 2.5GB and installed Windows XP guest on an Ubuntu host.

However I have used up all the 2.5GB space. Is there a way I can increase the 2.5GB easily?

Thank you
Usman
Here is simple way how you can do for win7, I did not test this for other version of windows.

http://rajendersaini.blogspot.com/2011/ ... k-vdi.html
iamarchie
Posts: 1
Joined: 3. Sep 2012, 17:16

Re: Howto increase hard disk size after installing a guest O

Post by iamarchie »

This worked for me (cool thing is that it makes a backup while you are cloning and expanding the disk):

0. Shutdown VM
1. Create Additional vmdk/vdi disk larger that the one you are trying to duplicate
Settings->Storage->select Controller in the Storage Tree then click the add hard disk icon. Follow the prompts to create the virtual disk.
2. Download Clonezilla Live CD - (a self running iso file)
3. Mount iso to VM - Settings->Storage-> select IDE Controller then click add CD/DVD icon (if not already there), then choose the Clonezilla Live iso just downloaded
4. Click on the "Live CD/DVD" checkbox (Attributes pane if the Clonezilla Live iso is selected in the Storage Tree pane)
5. Start the VM - follow the prompts to duplicate an image (disk to disk)
6. Shutdown the VM
7. Download GParted Live CD
8. Mount iso to VM - Settings->Storage-> select previously loaded CD/DVVD, and then click the CD/DVD icon in the attributes pane, then choose the GParted Live iso just downloaded
9. Click on the "Live CD/DVD" checkbox (Attributes pane if the GParted Live iso is selected in the Storage Tree pane)
10. Start the VM - follow the prompts.
11. Once the VM starts GParted is automatically started - you will notice that the new virtual disk will not be fully utilized. Expand the partition to fully utilize the disk.
12. Shutdown the VM - unmount the CD/DVD for GParted Live.
13. Done
spearman
Posts: 1
Joined: 30. Nov 2012, 12:35

Re: Howto increase hard disk size after installing a guest O

Post by spearman »

iamarchie wrote:This worked for me (cool thing is that it makes a backup while you are cloning and expanding the disk):

0. Shutdown VM
1. Create Additional vmdk/vdi disk larger that the one you are trying to duplicate
Settings->Storage->select Controller in the Storage Tree then click the add hard disk icon. Follow the prompts to create the virtual disk.
2. Download Clonezilla Live CD - (a self running iso file)
3. Mount iso to VM - Settings->Storage-> select IDE Controller then click add CD/DVD icon (if not already there), then choose the Clonezilla Live iso just downloaded
4. Click on the "Live CD/DVD" checkbox (Attributes pane if the Clonezilla Live iso is selected in the Storage Tree pane)
5. Start the VM - follow the prompts to duplicate an image (disk to disk)
6. Shutdown the VM
7. Download GParted Live CD
8. Mount iso to VM - Settings->Storage-> select previously loaded CD/DVVD, and then click the CD/DVD icon in the attributes pane, then choose the GParted Live iso just downloaded
9. Click on the "Live CD/DVD" checkbox (Attributes pane if the GParted Live iso is selected in the Storage Tree pane)
10. Start the VM - follow the prompts.
11. Once the VM starts GParted is automatically started - you will notice that the new virtual disk will not be fully utilized. Expand the partition to fully utilize the disk.
12. Shutdown the VM - unmount the CD/DVD for GParted Live.
13. Done

Thanks a lot iamarchie for sharing your know-how. This worked for me running a Windows XP guest.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Howto increase hard disk size after installing a guest O

Post by mpack »

Is it really so hard for you guys to read the user manual, discover the "VBoxManage modifyhd --resize" command, and do the job properly? Or even use CloneVDI - which makes it even easier? Must you keep using word of mouth to pass on an unnecessarily convoluted procedure that has been obsolete for years?
Post Reply