[Solved] How to make a virtual disk bigger?

Discussions related to using VirtualBox on Linux hosts.
piotao
Posts: 1
Joined: 7. Jun 2008, 23:39

it worked!!!

Post by piotao »

gushy wrote:JusTiCe8 is right, I've just done this by creating a bigger disk and then copying the contents.
  • Create a new disk using Virtual Disk Manager (in VirtualBox goto File -> Virtual Disk Manager)
  • download System Rescue CD
  • set your current VM to have the new disk image as it's second hard disk and the System Rescue CD iso file as it's CD
  • boot the vm from the CD
  • at the command prompt type startx
  • when X Windows starts, type gparted in the terminal that is open on screen
  • in gparted select the windows partition and choose copy
  • select the second hard disk
  • right click on the representation of the disk and click paste
  • gparted will prompt you for the size of the disk, drag the slider to the max size
  • click apply
  • wait .......
  • when it's done right click on the disk and choose Manage Flags, and select Boot
  • exit gparted and power off the VM
  • change the VM settings to only have one disk (the new bigger disk) and deselect the iso as the CD.
  • boot the VM into your windows install on it's new bigger disk!
I don't think I've missed any steps out....
THANK YOU, it worked PERFECTLY well. I converted my 10GiB disk into 50GB dynamic one and windoze boot up (with chkdsk after the first run) and works now even better. Also, I noticed a bit faster startup of virtual machine, maybe it is caused by less fragmentation, dunno. Windoze found new hard disk of course, which required one more restart, of course.

Thanks again, this was the brilliant idea which really works!
Fazer
Posts: 7
Joined: 17. Jan 2009, 15:54

Re:

Post by Fazer »

gushy wrote:JusTiCe8 is right, I've just done this by creating a bigger disk and then copying the contents.
  • Create a new disk using Virtual Disk Manager (in VirtualBox goto File -> Virtual Disk Manager)
  • download System Rescue CD
  • set your current VM to have the new disk image as it's second hard disk and the System Rescue CD iso file as it's CD
  • boot the vm from the CD
  • at the command prompt type startx
  • when X Windows starts, type gparted in the terminal that is open on screen
  • in gparted select the windows partition and choose copy
  • select the second hard disk
  • right click on the representation of the disk and click paste
  • gparted will prompt you for the size of the disk, drag the slider to the max size
  • click apply
  • wait .......
  • when it's done right click on the disk and choose Manage Flags, and select Boot
  • exit gparted and power off the VM
  • change the VM settings to only have one disk (the new bigger disk) and deselect the iso as the CD.
  • boot the VM into your windows install on it's new bigger disk!
I don't think I've missed any steps out....
I did that and when I booted the new disk, I got a black screen.

I had to reinstall Grub from a LiveCD (i.e. System Rescue CD) with these instructions:
http://forum.ubuntu.pl/showthread.php?t=45073
The description is in Polish, but the commands work.

Thanks for the tutorial!
kitkatbeard
Posts: 1
Joined: 15. Oct 2010, 16:25
Primary OS: Ubuntu 8.10
VBox Version: OSE Debian
Guest OSses: Win7

Re: [Solved] How to make a virtual disk bigger?

Post by kitkatbeard »

Following the steps, I was able to copy the disk. But gparted threw an error that it was unable to update the size of the disk, and when I booted into windows 7, it still reported the disk as being the old size. The windows disk manager does report the correct size, though. Any idea how to tell windows what size the disk is now?
mcongosto
Posts: 8
Joined: 27. Sep 2010, 12:21
Primary OS: MS Windows 2003
VBox Version: PUEL
Guest OSses: UBINTU

Re: [Solved] How to make a virtual disk bigger?

Post by mcongosto »

This is a bit stupid. One of the obvious advantages of virualization is the flexibility of the resources. Adding more HD space should be as easy as adding RAM.
LeeJeary
Posts: 1
Joined: 17. Feb 2011, 01:12
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: geuer

Re: [Solved] How to make a virtual disk bigger?

Post by LeeJeary »

Thanks for the steps... worked perfectly. Each step was spot on

Cheers,
Lee
brianr2
Posts: 3
Joined: 20. Feb 2011, 21:10
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: WindowsXP

Re: [Solved] How to make a virtual disk bigger?

Post by brianr2 »

The solutions in this forum for increasing the size of virtual drives clearly work but the latest versions of VirtualBox, 4.0 and later, have a built in facility to resize dynamic virtual disks.

I have installed VBox4.02 on Ubuntu 10.10 to run a Windows XP VM. I initially set up a 10GB C:Drive which rapidly filled up and so I resized it to 25GB using the VBoxManage command line interface. The command line used was:

[VBoxManage modifyhd "/home/brianr/VirtualBox VMs/Windows XP/Windows XP.vdi" --resize 25000]

The change is confirmed in the Storage section of Settings GUI as 24.41GB. However, Windows XP still sees the drive as 10GB and refuses to allow any more programs to be installed. I was under the (probably mistaken) impression that the revised allowable capacity would be automatically adjusted for the guest VM during the next startup.

What further action do I need to take to solve this problem? Any suggestions will be welcome.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [Solved] How to make a virtual disk bigger?

Post by mpack »

brianr2 wrote:The change is confirmed in the Storage section of Settings GUI as 24.41GB. However, Windows XP still sees the drive as 10GB and refuses to allow any more programs to be installed. I was under the (probably mistaken) impression that the revised allowable capacity would be automatically adjusted for the guest VM during the next startup.
If you image a drive of size X and copy the image onto a larger drive of size Y (which is effectively what you did), then it will work but the internal filesystem data structures inside the image still only expect to manage the first X MBs of data. You need to run a tool which understands that specific guest filesystem and can modify the data structures to expect YMB of space instead of XMB. Gparted is a free and easy to use tool which understands most popular guest filesystems. Download a gparted live CD, mount it in the VM, ensure the CD is first in the boot order, and boot up.

VirtualBox doesn't understand any guest filesystem, so you can't expect VBox to do this for you.
brianr2
Posts: 3
Joined: 20. Feb 2011, 21:10
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: WindowsXP

Re: [Solved] How to make a virtual disk bigger?

Post by brianr2 »

Many thanks, mpack, for your prompt response. In actual fact I had worked out the solution overnight, implemented it this morning and then tested it to make sure it worked - and it did. What lead me to the answer was considering what would be involved in automatically updating the C:Drive capacity in a Windows guest OS. It would be a monumental, if not impossible, task for VirtualBox without taking into account all the variants of Windows and Linux and various other OSs. Which is exactly what you explained more succinctly than I have. I think that a brief explanation,, to the effect that the resizing process must be completed in the guest OS, should be added in Section 8.21 in the VB manual to spare 80 year olds like me such mental anguish.

By the way, I used Paragon Partition Manager to resize the C:Drive since I have always used it in Windows but I use GParted in Ubuntu. Many thanks again for taking the time to reply so quickly.
stevefromoz
Posts: 1
Joined: 22. Feb 2011, 00:22
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Win2K8R2

Re: [Solved] How to make a virtual disk bigger?

Post by stevefromoz »

Brian, was there anything *special* you had to do to get the extra space recognized? My set up is Win764B host, win 2k8r2 guest, currently 20g dvi expanded to 30g. VB config shows the correct sizing but when using GParted (iso, booting to it directly on startup) it's still only showing 20g. It shows *no* free space on the drive at all.

If I'm following everything correctly, i should have been able to:
- expand the dvi (can now use cmdline to do this in VB) - done - success
- use gparted to add the additional empty space to the existing partition - not able to do, space not shown at all
- reboot guest system and the additional space is visible

Am i missing something? Maybe I can't use gparted with a 64b OS and alloc table/s? Somethign else?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [Solved] How to make a virtual disk bigger?

Post by mpack »

If you boot from a gparted live ISO then you probably aren't using a 64bit OS, you are in fact using whatever 32bit Linux variant that gparted app was bundled with - and you are accessing an NTFS drive whose data structures AFAIK have not needed to change because of 64bit CPUs.

If you don't see the available space on a Windows drive when looking at the drive with gparted then the possibilities are (exclude all you can prove to be false) :-
  • You failed to actually expand the drive
  • You mounted the wrong drive in the VM you booted gparted inside
  • You are using gparted incorrectly (basic info will be a thermometer type display showing used/unused areas of the drive)
  • Your drive is using a partitioning scheme that gparted doesn't understand. EFI? Windows Dynamic Disk?
The problem with that last idea is that even extended partitioning schemes retain an MBR for booting purposes, so gparted should still see something, and gparted should in any case still be able to get the size of the drive. One or more of the first three options seems more likely to me.
brianr2
Posts: 3
Joined: 20. Feb 2011, 21:10
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: WindowsXP

Re: [Solved] How to make a virtual disk bigger?

Post by brianr2 »

The way I used to get the extra disk space recognised was to install Paragon Partition Manager in the Windows guest OS and use that. The only drive it recognised was the virtual drive and it showed the currently used section followed by the unattached extension. I was then asked if I wanted to expand the drive to include the unattached space to which I said yes and the rest was automatic. Other partitioning programs recognised by the guest OS should work in a similar way.
Hope this helps
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [Solved] How to make a virtual disk bigger?

Post by mpack »

There's a rather nice article about gparted on Wikipedia, it includes the following screenshot of gparted in action: http://upload.wikimedia.org/wikipedia/commons/6/64/GParted.png.

That is the thermometer type display I was referring to. In this case it shows three partitions on the disk, plus one or two small unallocated areas. The first partition is very prominent simply because it's by far the largest, IMHO it would be easy to read the prominent display of the size of the first partition and misinterpret that as the size of the disk. In your case you should see a first one or more partitions in use, and a large unallocated space to the right.

You could settle this quite easily by grabbing your own screenshot of this gparted display, and posting the image here.
java007md
Posts: 2
Joined: 12. Feb 2012, 02:27

Re: [Solved] How to make a virtual disk bigger?

Post by java007md »

Thanks for this thread. gparted process worked well to copy a linux vm to a larger file. I needed to use a rescue cd to boot into the VM, then ran update-grub to be able to regain booting capabilities (marking the partition as bootable was not sufficient for me).
Post Reply