How to resize a VirtualBox disk partition |
|
|
| Written by axel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
VirtualBox is a cross platform full virtualizer for x86 hardware. It runs on Windows, Linux, Macintosh and OpenSolaris hosts and supports a large number of guest operating systems such as Windows, Linux and OpenBSD. In a previous guide I have shown you How to install Ubuntu Linux on Windows using VirtualBox . The procedure is the same if you want to install Windows on Linux. The guest operating system is installed on a virtual disk created by VirtualBox which is nothing more than a single .vdi file. When you first create the virtual machine you must set a certain size for this disk. However after playing with VirtualBox you might realize you need more space because your virtual disk is full So, in this tutorial I will explain how to enlarge an existing virtual disk or in other words how to resize your virtualbox vdi. I have a Windows XP installation running on Linux and specifically Archlinux and I am going to create a larger disk for Windows XP.**Note: The same procedure works for Windows Vista also. The only difference is that you have to use your original Vista installation CD for Bootmgr repair the first time the system is started after the GPARTED steps have been followed. (Thanks to Andrew) Run VirtualBox and go to File -> Disk Manager. ![]() Here as you can see I have a .vdi disk with a size of 10GB (1) which is almost full. So press the New button (2) to create a new virtual disk. ![]() Click next to go to the next page of the New Virtual Disk Wizard. ![]() Select Dynamically expanding image as Image type and click next. ![]() Select a name for the new image (1), this should be different than the existing one, and also set the size of the new disk (2). Here I've set it to 20GB. ![]() Press Finish to end the wizard. ![]() Now you should have 2 .vdi images in the Virtual Disk Manager. Click Ok to close the wizard.
Here we are gonna need GParted to copy the data of our old disk to the new one. GParted is the Gnome Partition Editor application for creating, destroying, resizing, moving, checking and copying partitions, and the file systems on them. It has a LiveCD which you must download from here . You don't have to burn it on a cd, just store the .iso somewhere in you hard disk.
Now select the existin Windows XP installation (1) and click on the Settings button (2). ![]() In the General -> Advanced tab set CD/DVD Rom as the first boot device. ![]() In the Hard Disks settings double click below your IDE Primary Master and set IDE Primary Slave and the new Virtual Hard Disk image. ![]() In the CD/DVD-ROM settings click on Mount CD/DVD Drive (1), choose ISO Image File (2) and use the folder button to browse to the location you have saved the gparted live cd (3). ![]() Now click the Ok button and start the Windows XP Virtual Machine. Press Enter to boot GParted Live with Default Settings. ![]() Don't touch keymap should be fine. Again press Enter. ![]() Select the Language you prefer. Press Enter for English. And again press Enter for the default video card settings. ![]() GParted will automatically scan your virtual disks. /dev/hda should be the old one and /dev/hdb the new one. Right click on your first disk and select Copy. ![]() Next select /dev/hdb from the drop down menu (1), right click on the unallocated space and select Paste (2). ![]() Drag the right edge (1) like you see in the screenshot so as not to leave any unallocated space in the new disk. Next click the Paste button. ![]() Now press Apply to apply the changes. ![]() When all listed operations are applied click the Close button. Again right click on the new partition /dev/hdb and click Manage flags. Here you should tick the boot flag. ![]()
Gparted will scan all devices once more. When it's done close the program and shutdown the live cd from the exit button. It will prompt you to press Enter. Now return to the VirtualBox application, select the Windows XP virtual machine and click the settings button. In the General -> Advanced tab select Hard Disk as the first boot device.
![]() In the Hard Disk settings use the delete button (1) to remove the IDE Primary Slave, leave just IDE Primary Master (2), and select the new .vdi (3). ![]() In the CD/DVD-ROM settings tick the Host CD/DVD Drive. ![]() Press the Ok button and start your Windows XP virtual machine. Windows might ask to check their filesystem. Just let them do it. ![]() After they automatically reboot you will log into your new resized virtualbox disk without having lost any of your data. You can now just delete the old .vdi. Enjoy! ![]()
Please do not use the comment function to ask for help! If you need help, please use our guides forum .
Did you enjoy this article? Please share it!
Set as favorite
Share This
Email This
Hits: 51911 Trackback(0)
Comments (88)
![]()
Nassim Bennouna
said:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks ! Everything is fully detailled. No place for any error. |
|
|
report abuse
vote down
vote up
|
Joseph
said:
| Thank you for the time and effort you put into this - surely saved me hours of trouble... | |
|
report abuse
vote down
vote up
|
Jin
said:
|
I fell in 2 problems: 1. BSOD: due to improper IDE Controller Type ( in Advanced Setup). I dont know why it changed. 2. not correct NTFS Journal in source system disk. I recommend to use ntfsfix /dev/sdxx as the first step in the procedure. Hope it helps |
|
|
report abuse
vote down
vote up
|
JRP
said:
Thank you, thank you and thank you! I started to use virtualbox last week and as everything was finally working, I got a nice message as I was running out of space . I was looking for an answer. Not only you gave the answer I was looking for, but it was so clear and well explained that I could not go wrong. Thank's again for your wisdom. You are a genius. Have a great day! I don't have a place to rate my vote, but you got 11 out of 10! |
|
|
report abuse
vote down
vote up
|
Enzo
said:
|
I'm using VirtualBox on Windows with Fedora 10 as the guest OS. I have a .vdi file for my virtual machine that is 8gb in size and I want to make it 40gb so I create another vdi file and attach it. I then boot up in gparted live cd and I can see both hda and hdb. In the Fedora guest OS, if I do fdisk -l /dev/hda I see that I have /dev/hda1 LINUX and /dev/hda2 LINUX LVM partitions. I didn't specifically create it this way, this is the way it came out from the standard Fedora 10 install. After I copy hda to hdab I end up with /dev/hdb1 and /dev/hdb2. hdb1 is ext3 format boot partition and hdb2 is unknown to gparted. The resize button is greyed out for hdb2 so you cannot resize it no matter what you do. I can resize the /dev/hdb1 partition if I want, but that is the boot partition and I need to resize /dev/hdb2 and it will not. Is this because it is a linux lvm? Any ideas? |
|
|
report abuse
vote down
vote up
|
kieran.tv
said:
| Just used the above procedure to resize a win 2003 server machine. Your solution worked ok for me, however i did have to use the ntfsfix to get it to grow the disk (resize) correctly. | |
|
report abuse
vote down
vote up
|
2cynykyl
said:
| I installed a virtual vista machine on my Ubuntu host and originally set the vista drive too big and not dynamic. I created a dynamic drive, copied everything over and rebooted vista with the second drive. Vista was not happy about it, and demanded that I insert my install disk. After a few hoops and reboots I was back in business! Thanks so much. | |
|
report abuse
vote down
vote up
|
Morten
said:
Just wanna say thanks. One of the best explained and most detailed responses I have seen. Its in my favorites |
|
|
report abuse
vote down
vote up
|
Mektub
said:
|
Axel, your tutorial is amazing ! Thank you very much. I did the above for a Windows 7 installation. When I booted from the new partition, I got: Bootmgr missing Press Ctrl-Alt-Del to reboot I then restarted from the Windows 7 install ISO and choose repair. I got a repair message, no options, choosed it. Still by booting I got the Bootmgr missing message again. So I rebboted from the install ISO, choose repair and this time got several repair options. Choosed 'repair startup'. And then it worked ! Hope it helps |
|
|
report abuse
vote down
vote up
|
Annette
said:
|
I am having the problem that despite seemingly following the tutorial closely, the Virtual Machine boots right into Windows rather than opening up gparted. Any ideas about what I might be doing wrong? Thanks, Annette |
|
|
report abuse
vote down
vote up
|
Annette
said:
| Axel was of course right. I'd done something stupid. But then I ran into another problem. Thought I'd share the solution here, in case others encounter something similar. The resized VDI would not boot (don't have the specific error handy). I found Tha-Dogg's helpful solution here: http://forums.virtualbox.org/viewtopic.php?t=6627, which involves a small change to the boot configuration. Now all is peachy. (Just be sure to follow instructions carefully -- attach the new vdi as "primary slave" to the old functioning vdi ("primary master") before doing anything else. Hope this saves someone some extra googling! | |
|
report abuse
vote down
vote up
|
nerdyrob
said:
| This was extremely helpful, worked like a charm using VirtualBox 2.1.4 and gparted-live-0.4.1-2.iso. Thanks!!! | |
|
report abuse
vote down
vote up
|
XtCrAvE
said:
|
So of course I went to the virtualbox site first, yea not alot of help, then I googled it for a few links, and found this one. Hands down the BEST walkthrough on this subject, and I just finished following it and it worked a treat! Windows didn't even ask me to check the disk. I need my virtualbox to run photoshop in and without it I'd be lost as I do alot of web graphics for clients and well, I ran out of room! Many Thanks! XtCrAvE - twistedpair.mobi |
|
|
report abuse
vote down
vote up
|
Ben Westing
said:
| Like others i was delighted i got my Virtualbox up and running but then saw i was running out of space! All other suggestions were not good (starting another partition) untill i cam across this guide! Fantastic mate! Really really appreciate the hard work and effort you put in to helping others! It was so easy to follow your step by step guide and hopefully soon, when it finishes operations, i will have more space on my XP to install Football Manager 2009 lol! Thanks once again mate!! | |
|
report abuse
vote down
vote up
|
dirtprof
said:
| Great guide--I ran it almost completely without a hitch. The only problem was that my mouse wouldn't work inside the guest gparted, but using alt-key combinations took care of that. Thank you again for your work--it was very helpful! | |
|
report abuse
vote down
vote up
|
Ricardo
said:
|
It seens to be a problem for gparted to copy when the 2 disks have similar capacities. Haven't test this to the limit, but maybe someone will have the same problem and i thought of warn. Btw, ty for the very good guide. |
|
|
report abuse
vote down
vote up
|
Nathan
said:
Fantastic guide - worked first time and saved me heaps of time! |
|
|
report abuse
vote down
vote up
|
Victor Garcia
said:
|
Thank you for this guide... no way anyone can mess this up... |
|
|
report abuse
vote down
vote up
|
Danie
said:
| Thank you this solved my problem with my fixed drive running out of space. Other methods were rather complex and this was easy and logical to follow. | |
|
report abuse
vote down
vote up
|
Andrew
said:
|
You may want to put an asterisk for Vista users - they will have to use their original Vista install CD for Bootmgr repair the first time the system is started after the GPARTED steps have been followed. Otherwise - a great guide and easy to follow. THanks. |
|
|
report abuse
vote down
vote up
|
Zettt
said:
|
Hi, I have Ubuntu as my guest system on a Mac. This tip helped to restore the boot menu back to normal: http://www.sorgonet.com/linux/grubrestore/ (Read section "HOWTO Restore GRUB") |
|
|
report abuse
vote down
vote up
|
Robert Seetzen
said:
|
Thanks a lot for this perfect howto! Only one problem occured: When booting from the new vdi, I got an error message like "hard disk read error, press ctrl+alt+del to reboot". But this could be fixed with Anettes tip from February 19, 2009 and the link to http://forums.virtualbox.org/viewtopic.php?t=6627 Again: thanks a lot! |
|
|
report abuse
vote down
vote up
|
rsz
said:
| I would like to see a similar step-by-step with the host/guest reversed. I too am at the mercy of computationally intensive Windows-only applications. | |
|
report abuse
vote down
vote up
|
Doug Simmons
said:
| Wow. Perfect! Thanks so much for taking the time to post this procedure! | |
|
report abuse
vote down
vote up
|
rsz
said:
|
Nevermind. I pieced together this recipe from a VirtualBox forum and it worked great and only took a few minutes. I went from an 8GB ubuntu guest on a XP host to a new 16GB ubuntu vdi guest. Here's what I did (adapted from http://forums.virtualbox.org/v...4&start=30): 1. Create 2nd larger size .vdi hard drive image. 2. Set as slave in specified Virtualbox. 3. Download and mount ISO for Clonezilla. 4. Make sure boot order is set to Cd-Rom before hard drive. Boot Virtualbox. 5. Follow Clonezilla prompts to copy old hard drive (/dev/sda) to new hard drive (/dev/sdb). Disk-to-disk, local-to-local, expert mode -r, -k1. 6. When done, set new hard drive image as master in Virtualbox. 8. Format, and set as slave or delete 1st hard drive image. |
|
|
report abuse
vote down
vote up
|
Jiak
said:
| I get a black screen after booting from the new virtual disk... It does not boot at all. | |
|
report abuse
vote down
vote up
|
sareesh
said:
|
From where i get the gparted live cd i download it from a site but i dont know how it install or use ? i dont see any iso file in the downloaded folder please help This e-mail address is being protected from spam bots, you need JavaScript enabled to view it |
|
|
report abuse
vote down
vote up
|
dpalme
said:
| Thanks much! Works as detailed, no missed steps. Great My-Guide-ster. Delivered as promised. A++++++++. | |
|
report abuse
vote down
vote up
|
Nicky
said:
| Axel, thanks for this information. It acknowledges that the Linux-community is a reliable one and (almost) every problem is solvable. | |
|
report abuse
vote down
vote up
|
pnf
said:
|
Nice guide & comments. For me, the new vdi didn't boot correctly. It hung at the login screen before showing the user accounts. I finally got it to work with the following modifications to axel's guide (VirtualBox version 2.2.4, gparted version 0.4.6): 1) In gparted, copy old vdi partition and paste to new *without resizing* (leaving unallocated space on the new vdi). 2) Boot the new vdi (as IDE Master) to verify that it works. 3) Use gparted to grow the partition to fill the new vdi. 4) Boot the new vdi. XP will do a CHKDSK during the boot process (as described in the guide). One mystery that may not be a general occurrence: XP "installed new hardware" after booting the new vdi (at both steps 2 and 4). |
|
|
report abuse
vote down
vote up
|
rjen
said:
|
Hi I just followed this guide to resize my virtualbox and everything now works fine, except I don't seem to have network connections. Do I just need to configure my ip address once again or should it have worked regardless? Sorry if this is a very basic question.. thanks, |
|
|
report abuse
vote down
vote up
|
Adam
said:
|
I've attempted this process numerous times and every time the boot to XP renders the following message on a black screen... A disk read error occurred Press Ctrl+Alt+Del to restart I also noticed that the gparted process ends with errors. It appears to be fixable by running "ntfsfix /dev/" from a the term window. The "check" action says all is good, but XP still does not boot. Yes, it's flagged with "boot". Oh well, it'd be faster to just load the OS onto a bigger VDI at this point. What a waste of time. Sadly, you'd thing resizing a disk would be an option in VirtualBox. Once again, nothing's free. Just marketing to get me to put down for the real features. heh. ~ Adam |
|
|
report abuse
vote down
vote up
|
Emmanuel
said:
|
Excellent howto I just extended my VDI size by 5GB Thanks x 1000 !! |
|
|
report abuse
vote down
vote up
|
Paul
said:
|
I can confirm that your instructions work perfectly for Windows Vista, too. Thank you very much |
|
|
report abuse
vote down
vote up
|
Wayne
said:
Worked perfect. 5 stars for the faultless explanation too Cheers |
|
|
report abuse
vote down
vote up
|
Tuxor
said:
It worked like a champ - Windows 2003 Server virtual instance. - Created a new vmdk disk with vmware-vdiskmanager -c -s 20Gb -a ide -t 0 'System.vmdk'. Attached via LSILogic driver. - Used sysrescuecd instead, since Gparted live thought my disk (vmdk format) was 8 Tb when it was only 20 Gb. (sysrescuecd is better on recon scsi maybe?) - After closing down Gparted, ran ntfsfix /dev/sd[x][n]. - Restarted machine with the newly created hard disk, watched chkdsk run automagically while - Took a sandwich in the kitchen, and went to bed with a smile! Thank You! |
|
|
report abuse
vote down
vote up
|
King
said:
| Just want to say thanks as the tutorial together with user remarks made me grow my disk just fine! | |
|
report abuse
vote down
vote up
|
Jeff Mo
said:
| Annette's tip worked for me as well with a Windows XP SP3 disk. Thanks for saving me a huge headache!!! | |
|
report abuse
vote down
vote up
|
Rob
said:
|
I had to use the Ubuntu LiveDVD for Gparted b/c the Gparted CD wouldn't work. After resizing the disk size in Ubuntu, Windows doesn't recognise the new size. It thinks it's still 10GB, not 50. Any suggestions? |
|
|
report abuse
vote down
vote up
|
Rob
said:
| The disk I'm resizing doesn't have an operating system on it (yet) so I can't boot it up, and the the interface in my version of Virtualbox is different; but excepting for those discrepancies I tried to follow your instructions as closely as possible. | |
|
report abuse
vote down
vote up
|
Gary
said:
| You did a really nice job of documenting a 'scary' process. It worked perfectly. Well done. | |
|
report abuse
vote down
vote up
|
reayn
said:
|
The steps are pretty much the same up to creating a new vdi hard-disk and clicking on the settings of the VM you want to run to add this new hard-disk. Then log into ubuntu VM and install gparted > sudo aptitude install gparted then using gparted, format the new hard disk, close gparted and then mount the new hard disk > mount /dev/sdb1 /media/disk and you have more space! |
|
|
report abuse
vote down
vote up
|
s3agull
said:
Thank you very much for this incredibly detailed guide I used it to resize a virtual hard disk with Ubuntu installed, and VirtualBox running on a Vista-64bit machine. NOTE: After the steps above, when first running the virtualized Ubuntu, i had to reinstall grub (boot manager) by using the Ubuntu Live CD: - boot the virtual hard disk with the Ubuntu Live CD - check (for example with the gparted GUI) the name of the partition which will contain the grub - reinstall grub on the right partition - reboot from hard disk Hope will help |
|
|
report abuse
vote down
vote up
|
Ankur Dave
said:
|
Thanks for this guide! I encountered a few snags while growing a Windows XP machine, but ultimately got things to work: At the end of the copy and resize, gparted complained that it couldn't resize the partition, since the filesystem was unclean. But after its display refreshed, it showed the new size anyway (but, as I later found out, this wasn't correct). I think this was because I had used VirtualBox's "Power off the machine" option instead of doing a proper ACPI shutdown. I tried booting the new drive, but I got the same error as Robert Seetzen ("hard disk read error, press ctrl+alt+del to reboot"). I used Annette's link (February 19, 2009), which let me boot the drive successfully. Once I had booted the new drive, it still showed the old size, despite gparted's claim to have resized it. This was, of course, because of the "filesystem unclean" error. So I started gparted again and resized the partition to the same size. And Windows finally saw the extra space. Hope this helps someone else |
|
|
report abuse
vote down
vote up
|
Dr_ST
said:
|
Hi, thanks a lot for the wonderful and complete setup, it worked like a charm! One step is missing before copying the content, one has to define a partition type to the new vdi, and then you can paste it. Little correction, but just in case someone would be troubled :-) cheers ! |
|
|
report abuse
vote down
vote up
|
BluesBrother
said:
rsv's post on July 14, 2009 worked perfectly for me. I used it to resize the VDI for an Ubuntu guest running on a Windows XP host. I doubled the size of the VDI, and the really sweet part is that the utilization of my root file system dropped from 95% to just 59%! Thanks, rsv! |
|
|
report abuse
vote down
vote up
|
Scorn
said:
| A very informative and detailed howto, thanks very much, helped me!! | |
|
report abuse
vote down
vote up
|
Jim
said:
|
Just like most of those commenting, a big thank you. Pictures tell a lot. Enlarged a Windows XP guest from 10G to 20G on an OSX Snow Leopard host. |
|
|
report abuse
vote down
vote up
|
DP
said:
|
Thank you - worked a treat after a while of trying to achieve this. A minor thing which might be worth mentioning for others. I don't know if it is always the case, but while carrying out the copy procedure in GParted, I nearly reset the machine thinking it had failed as there was no progress indication - just the bar moving back and forth but nothing else to indicate it was copying my 10GB of HDD... |
|
|
report abuse
vote down
vote up
|
Kenny
said:
| Worked like a charm for me with XP Pro... great that you put this out there. | |
|
report abuse
vote down
vote up
|
rob haag
said:
Thanks so much for your guide, minor differneces (new version of Virtualbox), but no head-scratchers! I didn't think of booting my VM with a liveCD...I should think of it as an actual computer sometimes, that may help Again, Thanks! |
|
|
report abuse
vote down
vote up
|
Write comment
You must be logged in to a comment. Please register if you do not have an account yet.
| < Prev | Next > |
|---|






VirtualBox is a cross platform full virtualizer for x86 hardware. It runs on Windows, Linux, Macintosh and OpenSolaris hosts and supports a large number of guest operating systems such as Windows, Linux and OpenBSD. In a previous guide I have shown you 
























as I was running out of space
. I was looking for an answer. Not only you gave the answer I was looking for, but it was so clear and well explained that I could not go wrong. Thank's again for your wisdom. You are a genius.
