Howto increase hard disk size after installing a guest OS

This is for discussing general topics about how to use VirtualBox.
dananarama
Posts: 4
Joined: 11. May 2009, 17:23
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu 8.04

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

Post by dananarama »

Hello,

I found myself in the same situation -- I needed a WinXP vm but made the vdi too small. I just had success using Clonezilla to clone and proportion the small partition to a new vdi that I made with plenty of room.

Notes from my procedure:
- Created new virtualbox harddisk (dynamic) with plenty of room.
- Added the new hd to the windows vm, along with the iso for clonezilla. Made new hd primary master, old (small) hd secondary master.
- Booted into Clonezilla
- Selected copy local partition to local partition.
- Selected 'fix errors with fsck', make new partition table proportional.
- Selected write new partition - 'works for mbr...'
- After this was complete, removed old hd from virtual machine.
- WinXP booted fine and showed the entire hd-size as disk space.

Thanks for all your notes. Hope this helps.
merkk
Posts: 12
Joined: 28. Jan 2010, 03:32
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Winxp

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

Post by merkk »

Just wanted to confirm this worked for me as well.
mpack
Site Moderator
Posts: 39156
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 »

merkk wrote:Just wanted to confirm this worked for me as well.
Yes, of course it will work, but it's an unnecessarily long and tedious way of going about the task. That procedure will typically take something like 30mins to an hour and require a lot of juggling of VM settings, CloneZilla images, second hard disks etc etc; if you are running on a Windows host then CloneVDI will do the same in minutes and only require a few mouse clicks and a lot less disk space - as already mentioned in this thread.
merkk
Posts: 12
Joined: 28. Jan 2010, 03:32
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Winxp

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

Post by merkk »

actually, using this method took me about 10 minutes. This was from taking a 2gb image and cloning it to a 10gb image. This thread was pretty long so i didn't read the whole thing. I didn't notice any mention of cloneVDI. Maybe next time i'll try that.
mpack
Site Moderator
Posts: 39156
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 »

merkk wrote:actually, using this method took me about 10 minutes.
My mistake, I didn't read the procedure correctly - and didn't know that CloneZilla could clone and enlarge a partition directly from one drive to another (I assumed that an intermediate image file was involved). Neat feature. In that case the time advantage probably isn't as great as I assumed.
merkk
Posts: 12
Joined: 28. Jan 2010, 03:32
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Winxp

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

Post by merkk »

guess we both learned something then :)
peejay
Posts: 11
Joined: 5. Sep 2008, 13:40
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Ubuntu 9.10, Windows Pro XP, OpenSolaris, Chrome OS

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

Post by peejay »

I tried to follow danorama's procedure, but went wrong about half way through. Clonezilla is a nice application, but there is very little help in selecting the right options for what you want to do. I cloned my 10Gb virtual disk into a 25Gb new disk, and the cloning went smoothly, taking about 15 min, but the new disk was the same size, with 15Gb unoccupied. Rather than go through the hassle of creating a new virtual machine and doing it all over again, I tried various free partition-managing applications for Windows. The first three I tried did not work for some reason or other, but finally I was successful in enlarging the new partition with EASEUS Partition Master to fill the new HD, and I now have a 25 Gb Virtual Windows HD running XP under VirtualBox on my Mac.
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

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

Post by TerryE »

This is really a case of not understanding the functionality of the package. You can copy partitions from drive A to Drive B and/or resize partitions. I guess that you forgot to do the latter. I've done this no probs before with NTFS, Ext3 and Ext4 partitions. Still if you've managed it with another tool and got it working then that's the main thing :-)
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
maddentim
Posts: 1
Joined: 2. May 2010, 19:03
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP, Linux various

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

Post by maddentim »

I successfully resized using gparted. I followed this guide: http://www.my-guides.net/en/content/view/122/26/
sunbod
Posts: 1
Joined: 4. May 2010, 19:16
Primary OS: OpenSolaris 10
VBox Version: OSE other
Guest OSses: Ubuntu & windowsXP

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

Post by sunbod »

I ran into this same problem myself a little while back.

Running Opensolaris host, with XP guest I had created a fixed 5Gb HD, then ran out and needed to make it bigger, this is what I did and it worked a treat.

Some of this can be done via the GUI but I decided to do it via command line, besides saves me trying to explain what to click on in a GUI.

Firstly create a new vdi, under ~/.VirtualBox/HardDisks
#VBoxManage createhd -filename new.vdi --size 10000 --remember
... See More
This creates a 10Gb VDI.

Next you need to clone the VDI, make sure you fully qualify the VDI paths seemed to give me troube when I didn't :-
#VBoxManage clonehd old.vdi new.vdi --existing

Once cloned you need to attach the new vdi and detach the other.
#VBoxManage modifyvm MyVMName --hda none
#VBoxManage modifyvm MyVMName --hda new.vdi

Boot the VM and then check the disk size, shows unallocated space, I then used free Partition Wizzard 5 to resize the partition, booted again to check machine now showed full partition.

Now just need to remove and delete the old VDI, again you need to fully qualify the path to the vdi.
#VBoxManage closemedium disk old.vdi
#rm old.vdi

Sorted, I now have an extra 5Gb in my windows VM. You should be able to use the same method for a linux VM to, something like GParted is a free partion tool for linux.

Cheers Steve
PatKam_AU
Posts: 1
Joined: 24. May 2010, 04:57
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, Windows XP, Windows Server 2003

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

Post by PatKam_AU »

i have another solution that uses ghost32.exe inside the Windows Guest OS that needs resize!

i have made a step by step instructions in html and gifs.

http://rapidshare.com/files/390892218/V ... nsOnly.zip
mpack
Site Moderator
Posts: 39156
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 »

I assume that people are coming to this thread by following the link from the Wikipedia article. If so, I wish some of you guys would actually read all of the information already given (especially the more uptodate info) before endorsing old and outdated advice.

There are basically two ways to expand disk size after installing the guest OS :-

The old way:
Use VBox to create a new hard disk drive of the desired size, attach it as a second HDD to the same VM as the first HDD, then boot up the VM with a live CD containing the disk or partition copying software of your choice (Acronis, Ghost, Gparted etc - even dd is possible as a last resort for masochists). Copy your partition(s) from disk 1 to disk 2 and resize them to fill the new disk. Expect to spend at least half an hour doing this, longer for really big drives.

The new way:
Run the CloneVDI tool. Enter name of source VDI and desired disk size into dialog box. Click "Proceed" button. Expect to spend maybe 5 minutes for a typical VDI, longer of course with big drives.

The CloneVDI tool has existed since mid September 2009. It was created specifically so as to remove the need to recommend an embarassingly complicated rigmarole for performing what should have been a simple task. So, in late May 2010 it is quite disheartening to see people still joining the site in order to provide uninformed endorsement of the obsolete procedure.
waverider
Posts: 14
Joined: 2. Jun 2010, 05:03
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows7

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

Post by waverider »

Hello,
Host OS - Kubuntu 10.04 Guest OS Windows XP
I have used CloneVDI running under wine and it appeared to work fine. I increased the size of an XP hard drive from 10Gb to 25Gb, set up a new machine (25Gb) and the cloned hard drive worked perfectly.
However, when I tried to add some data it came up as Disk full. Reviewing the settings shows me that the hard drive is still the same size as the original - even though CloneVDI says it has been increased to 25Gb. It appears to report the that size has been increased when in fact it has not?

Perhaps I have made an error somewhere?
mpack
Site Moderator
Posts: 39156
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 »

waverider wrote:Reviewing the settings shows me that the hard drive is still the same size as the original - even though CloneVDI says it has been increased to 25Gb. It appears to report the that size has been increased when in fact it has not?
Perhaps I have made an error somewhere?
The drive size has been increased, but the partition info and filesystem on the drive is the same as before (data describing both got copied like every other bit of data on the old drive). If yours is a popular filesystem (e.g. NTFS, FATx, EXTx) then you can boot up the VM using a gparted live cd ISO, and increase the partition size to fill the new drive.

CloneVDI does actually have its own optional partition resize feature which probably works for most, however some say it doesn't work for them. gparted seems to be more reliable.
waverider
Posts: 14
Joined: 2. Jun 2010, 05:03
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows7

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

Post by waverider »

Thanks mpack - that worked perfectly.
Post Reply