[Solution] Resize Windows XP Guest Partition

Discussions about using Windows guests in VirtualBox.
rcman80
Posts: 1
Joined: 21. Sep 2007, 00:41
Location: Los Angeles, CA

[Solution] Resize Windows XP Guest Partition

Post by rcman80 »

This solution is out of date and you need to consult your VirtualBox user manual about how to resize your drive. See VBoxManage modifyhd for the syntax.
Then use Gparted in the guests CD to boot and increase the partition.


Originally I created a Windows XP Partition of 10GB when I installed it as a guest on my Linux system. Quickly, I realized I needed more space. I wont bore you with the details of my search for a way to do this. This is the method I used to increase my Windows XP Partion size.

Tools Required :
  • A Disk Imaging Program
  • Patience
  • BACK UP YOUR DATA
For my Disk Imaging Program, I used Self Image.
  1. Install Self Image on your Windows XP Guest.
  2. Shut Down your Windows XP Guest.
  3. Create another Virtual Disk to the size you want.
  4. Attach your newly created Virtual Disk to your Windows XP Guest.
  5. Boot back into Windows XP Guest.
    Windows will install the new drive and ask you to reboot.
  6. Format the new Virtual Disk in NTFS format.
  7. Start up Self Image (or your Disk Imaging Program of choice).
  8. For Input choose Drive.
  9. For Input Location select the harddisk with the lowest number(entire disk), as this is your original Windows XP Guest Virtual Disk.
    In my case it was: \Device\Harddisk0 (entire disk)

    **MAKE SURE YOU SELECT THE ONE WITH (entire disk) OR IT WON'T WORK.**
  10. Leave Processing at None.
  11. For Output choose Drive.
  12. For Output Location select the harddisk with the highest number(entire disk) as this is your new Windows XP Guest Virtual Disk.
    In my case it was: \Device\Harddisk1 (entire disk)

    **MAKE SURE YOU SELECT THE ONE WITH (entire disk) OR IT WON'T WORK.**
  13. Click Start.

    INTERLUDE: At this point, depending on the size of your original Virtual Disk and your computer, you may want to find something else to temporarily occupy your time with.
  14. Once the imaging is done, click Exit.
  15. Shutdown your Windows XP Guest.
  16. In Virtual Box Deselect your original Windows XP Guest Virtual Disk and make the new Windows XP Guest your Primary Virtual Disk. **Do not delete the original Virtual Disk just yet.
  17. Boot into your new Windows XP Guest Virtual Disk.
  18. Windows will scan the new Virtual Disk and then reboot.
  19. Open your command prompt: START MENU - RUN - TYPE COMMAND - CLICK OK
  20. Type diskpart.exe
  21. Type select volume n where n is the number to your Virtual Disk.
  22. Type extend and hit Enter.
    Windows will extend your partion to the FULL amount of the new partition as prior to this command your C:\ drive is still the size of the original Windows XP Virtual Disk.
  23. Type exit and reboot your Windows XP Virtual Guest.
DISCLAIMER: There is NO GUARANTEE OR WARRANTY this solution will work for everyone and/or will not destroy any data, USE AT YOUR OWN RISK!. This solution is not meant to be a comprehensive and/or all inclusive, but one of possibly more ways to accomplish this task. Please refer to each company/individual(s) website regarding their product; the Virtual Box website for Virtual Box, Self Image Website for Self Image, Your Therapist for Patience, and Microsoft for Diskpart.
You take away everything from a man and you find his friends
Ingo
Volunteer
Posts: 731
Joined: 22. Aug 2007, 10:13
Location: Germany

Post by Ingo »

Here is a little bit simpler way without the need of installing a disk imaging program.

http://forums.virtualbox.org/viewtopic.php?t=1966
Last edited by Ingo on 4. Oct 2007, 13:43, edited 1 time in total.
Arlos70
Posts: 1
Joined: 28. Sep 2007, 05:45

Resizing Windows guest partition

Post by Arlos70 »

I used rcman80's method as a guide...my computers never seem to let me do anything without teaching me something new.

The first issue I ran into was my Windows guest was FAT32, which doesn't work with DISKPART unless it is converted to NTFS. DISKPART also does not work on the system drive, so you must EXTEND before changing your new drive to primary.

To add a few things to rcman80's method:

1. take a snapshot of your current Windows guest.
2. create a new drive of your target size, and attach to your guest as secondary.
3. start Windows guest, install Self-image.
4. if Windows doesn't install the new drive for you:
a. right click on "My Computer" and select manage.
b. select Disk Management under Storage.
c. change your CD drive to E:
d. initialize your newly added hard drive as D:
e. close
5. use Self-image as outlined above.
6. after Self-image has completed. restart Windows ( nothing shows on your new drive until you restart)
7. I took this opportunity to error check and defrag my new drive completely. Right click drive, properties, tools.
8. on the start menu open a command prompt (run, cmd)
9. type VOL D: (note Volume ID - not drive name, converting to NTFS might change this, and WPA looks for this as one of your "votes")
10. type CONVERT D: /FS:NTFS
11. check VOL D: again, and change your ID if necessary: http://www.microsoft.com/technet/sysint ... umeId.mspx
12. now use DISKPART as shown above to EXTEND your new drive.
13. once completed, shut Windows guest down, un-check new drive as secondary, and change your primary to your new drive.
14. restart Windows on your resized drive.

NOTE: I wanted to keep a version of XP SP1, and a version with SP2. I attached my newly sized drive to a new virtual computer (use same MAC address for another "vote") instead of my original. Then once everything was working on my new drive, I reverted back to the snapshot taken before I started this upgrade on my original drive.
romcart
Posts: 1
Joined: 12. Jun 2008, 07:08

Resizing Windows guest partition

Post by romcart »

I too followed rcman80's method, and everything went well until I tried to boot up my virtual machine using the new disk, at which point I received a black screen telling me:

A disk read error occurred
Press Ctrl+Alt+Del to restart


Fortunately I wasn't the first to have this problem, and I found a solution here in the forums.
  1. Install Boot Builder in your working virtual machine. http://www.majorgeeks.com/Roadkils_Boot ... d4980.html
  2. Launch Boot Builder
  3. Read the boot sector from the new disk (Drive D: in my case)
  4. Change the heads setting to 255
  5. Write the modified boot sector back to the same disk (Drive D: again)
After that my new disk booted up fine. You can find the original post with that fix here: http://forums.virtualbox.org/viewtopic.php?t=6627
touristguy87
Posts: 19
Joined: 14. Mar 2009, 00:49

Re: [Solution] Resize Windows XP Guest Partition

Post by touristguy87 »

please, please please make this a 'sticky" somewhere. without changing the url if possible because I'm going to link to it, save it all that good stuff.
thanks
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: [Solution] Resize Windows XP Guest Partition

Post by Sasquatch »

There's a more generic method that doesn't involve installing software on the Guest system. Please see the VirtualBox FAQ for the link to the post.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
vmichael@live.com
Posts: 9
Joined: 11. Mar 2009, 19:54

Re: [Solution] Resize Windows XP Guest Partition

Post by vmichael@live.com »

I found a very simple stepwise approach here.
http://www.my-guides.net/en/content/view/122/26/
jdrews
Posts: 1
Joined: 9. Jan 2010, 09:15
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Ubuntu 9.10, Windows XP SP3

Re: [Solution] Resize Windows XP Guest Partition

Post by jdrews »

I ran into this page after searching around on Google. I tried the steps listed in rcman80 opening post, but the steps with the extend method (steps 19-22) did not work for me. I think the reason is that my disk was a basic disk which does not have extend capabilities. (more info here: http://support.microsoft.com/kb/325590)
It gave me this error when typing in "extend" on the right volume:
"Diskpart failed to extend the volume.
Please make sure the volume is valid for extending"


I looked around some more and gave GParted a try, fully expecting to have to boot off the XP install CD and clean up the MBR with the Recovery Console... but I didn't! After expanding the drive with gparted-live (http://sourceforge.net/projects/gparted/files/ version 0.4.6-1 iso, Windows XP booted just fine and shows an expanded drive size.

FYI: before trying gparted, I also tried converting the basic disk to a dynamic disk. It still wouldn't run expand because the partition was originally a basic disk partition. :( Hurray for gparted though! :)

Hope this helps someone out and sorry for opening an old thread.
fastijum
Posts: 2
Joined: 21. Nov 2009, 11:02
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: many Linuces, *BSD, Win98SE to Win7, OpenSolaris
Location: Strafford, PA

Re: [Solution] Resize Windows XP Guest Partition

Post by fastijum »

jdrews wrote:FYI: before trying gparted, I also tried converting the basic disk to a dynamic disk. It still wouldn't run expand because the partition was originally a basic disk partition. :(
I can’t remember where I read this, but I believe freeing up about 4 MiB (or 8?) at the end of the disk where the partition is, would enable you to convert the disk from basic to dynamic. I learned this from someone asking why the Windows installation partition editor would leave some unused space at the end of the disk, and the answer was that such space would be necessary in case of a conversion to dynamic disk.

Hope this helps.
rmoraes
Posts: 1
Joined: 24. Jan 2011, 10:31
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: Windows XP

Re: [Solution] Resize Windows XP Guest Partition

Post by rmoraes »

vmichael@live.com wrote:I found a very simple stepwise approach here.
http://www.my-guides.net/en/content/view/122/26/
I confirm that this is a good tutorial. Worked flawlessly.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [Solution] Resize Windows XP Guest Partition

Post by mpack »

"Working" is not the only criterion; getting the job done without a silly expenditure of time and effort is also important to some.

This thread is ancient and there now exists several ways to enlarge an existing disk in a few minutes, and which do not require running an imaging app inside the guest. For example VirtualBox v4 includes a VBoxManage command which can resize a VDI, or there's my CloneVDI tool for those who want a GUI equivalent (runs on Windows or Wine).

ps. On the Windows basic disk / dynamic disk thing (not to be confused with VBox fixed vs dynamic disk images), it's my understanding that you can't resize a boot disk even if it is dynamic? Personally I would keep it a basic disk, that way it can be resized by third party tools such as gparted, and backed up by tools such as Acronis.
dandv
Posts: 7
Joined: 7. Mar 2011, 22:20
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows XP

Re: [Solution] Resize Windows XP Guest Partition

Post by dandv »

rmoraes wrote:
vmichael@live.com wrote:I found a very simple stepwise approach here.
http://www.my-guides.net/en/content/view/122/26/
I confirm that this is a good tutorial. Worked flawlessly.
This tutorial didn't quite work for me. I wanted to resize a 2GB .vdi file to 10GB. Host: Win7, guest: WinXP. Booted off GParted, copied the partition, set the boot flag, but when booting, I got the "Disk Read Error". Following the advice in this thread, I set the heads count to 255. That did get XP to boot, but it then froze at the blue splash screen.

I then loaded the larger .vdi as Secondary Slave, booted off the original 2GB .vdi, and let Windows fix the NTFS errors it found (chkdsk). However, that didn't improve things. XP still wouldn't boot.

In the end, I just reinstalled XP.

Now I must ask: WTF?! We're in 2011, hard disks have been around for 30+ years, and we still don't have tools that can correctly enlarge a partition and keep it bootable?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: [Solution] Resize Windows XP Guest Partition

Post by Perryg »

Did you also look in your VirtualBox users manual? This thread is really old and things have changed.
See VBoxManage modifyhd --resize. Simple enough to use to increase the size of the drive. Gparted will increase the size of the partition.
dandv
Posts: 7
Joined: 7. Mar 2011, 22:20
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows XP

Re: [Solution] Resize Windows XP Guest Partition

Post by dandv »

Perryg wrote:Did you also look in your VirtualBox users manual? This thread is really old and things have changed.
See VBoxManage modifyhd --resize. Simple enough to use to increase the size of the drive. Gparted will increase the size of the partition.
That's great news. I've PMed the OP asking to update their 2007 post.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: [Solution] Resize Windows XP Guest Partition

Post by Perryg »

I wouldn't hold my breath. They haven't logged in since Sun Sep 23, 2007 2:30 pm.
Post Reply