Howto increase hard disk size after installing a guest OS

This is for discussing general topics about how to use VirtualBox.

Another solution

Postby klix » 15. Feb 2008, 10:15

1. create a new VDI image with the size you want
2. attach your new image as the slave
3. boot some linux live CD in your virtual machine
4. check /proc/paritions which drive is original and which is new (watch the size :-))
5. dd if=/dev/olddrive of=/dev/newdrive (in the most cases dd if=/dev/hda of=/dev/hdb)
6. reboot
7. attach your new image as the primary master
8. boot the OS and use some software for resizing partitions (e.g. parted in linux or partition magic in windows - if you use linux you can't use parted on master partition, so you can use your live linux cd ;-))
9. well done - tested on Windows XP guest and FC6 host and it works perfectly

Klix
klix
 
Posts: 1
Joined: 15. Feb 2008, 10:05

Postby efffourthirty » 25. Feb 2008, 03:28

Klix,

I like your method and it worked great for me. I did the following to go from 6GB to 10GB

1. Booted up using the SYSRECCD from http://www.sysresccd.org
2. I executed 'fdisk -l' to see both the partitioned 6GB drive (hda) and the unpartitioned 10GB drive (hdb)
3. I executed 'dd if=/dev/hda of=/dev/hdb'. Both vdi files were about 5.4GB
4. I executed 'fdisk -l' which now showed hdb as a partitioned drive - cool
5. I started gparted and both partitions looked good. I could have resized it then but decided to test it first by making the 10GB drive the primary and dropping the 6GB drive then starting windows - everything was good
6. Booted up to SYSRESCD again and this time used gparted to resize the first parttion to use the full 10GB disk - size on disk unchanged at 5.4GB
7. Booted up to windows again and as expected it ran a disk check and everything was perfect - windows sees 10GB and the vdi will grow as needed

Efffourthirty
efffourthirty
 
Posts: 8
Joined: 25. Feb 2008, 01:24

Postby BitBasher » 25. Feb 2008, 14:05

I made a bigger WinXP VM using BARTPE (XPE) + Acronis TI11. Worked like a charm. My steps (from memory)...

1. Release old WinXP VDI from VM.
2. In vbox GUI, make a new VDI the size you want (probably bigger).
3. In vbox GUI, make a HD-less VM to host a BartPE ISO image (set type to XP). Set the CDROM to your BartPE ISO image.
4. Attach the old WinXP VDI to the BartPE VM primary IDE.
5. Attach the new (unused) VDI to the BartPE VM secondary slave IDE.
6. Boot your handy-dandy BartPE VM - it'll be fast if hosted via ISO.
7. Run your favorite disk cloning software under BartPE.

Typically, the old image will be C: but the new unformatted VDI will not have a drive letter. Most good cloning software (like TI11) do not need drive letters - they work off the partitions themselves.

8. After cloning, shutdown the BartPE VM and RELEASE both VDIs from it.
9. Reattach the old WinXP VDI to your old VM (if you had one).
*10. Create a new WinXP VM and attach the new WinXP VDI to it.

*I'm not sure if a new VM is required for the new VDI, but that's what I did. If you attached the new VDI to the original WinXP VM it might work.

The above isn't theory - I did this and it worked great. I upped my WinXP VDI size from 10GB to 16GB. On the first boot of the new WinXP VDI, the OS will discover the "new" harddisk and suggest you reboot. Once you do that, it'll run flawlessly.

Bit.
BitBasher
 
Posts: 13
Joined: 25. Feb 2008, 10:51

Postby SoftDux » 4. Mar 2008, 13:44

I'd like to give some input on this, and maybe a sort of feature request.

The ONLY reason one can't increase space on a physical HDD, is cause of the physical limitations of the HDD. But, increasing the space on a smaller logical volume on that same HDD is fairly easy, for example with LVM (Logical Volume Man agent) in Linux, it's as easy as decreasing one of the other volumes, and and increasing the one in questions, or differently put. If you setup only the needed volumes on Linux, and leave space for growth, then it's easy to increase the size of one of the partitions when needed.

So, why not have the same characteristics on the VB VDI's? They are after all logical just files, which reside on a partition (regardless of the file system & HDD)
SoftDux
 
Posts: 26
Joined: 4. Jul 2007, 15:30
Location: Johannesburg, South Africa

Any other official way...

Postby Jaime » 5. Mar 2008, 12:07

So is there any other way to increase the disk size or logical volume without having to clone or re-create a new disk? I'm just wondering since I too ran out of space, but created all automatically expanding vm's. I remember I did this with the vmware and well, Meaning I was able to just increase the disk size with a command since I wasn't using the whole assigned space of the vm. I was just wondering if VirtualBox can do something like it as well. I looked through the manual, but can't find anything like that.
Jaime
 
Posts: 33
Joined: 5. Mar 2008, 11:54

Postby postfix » 5. Mar 2008, 13:30

Just kidding :wink:

In the evening I will trying to increase a vdi file directly. I want to see whats going on and what should be changed somewhere else.

Using a clonevdi-copied of a working vdi file I, than trying to increase it on a winxp-host unsing
Code: Select all   Expand viewCollapse view
imdisk -e [-b offset] [-s size] [-o  opt1[,opt2 ...]] [-u unit | -m mountpoint]

as discribed in thread http://forums.virtualbox.org/viewtopic.php?t=4748

Of course increasing the file system structure must be done, too.
postfix
 
Posts: 40
Joined: 14. Jan 2008, 13:05

For windows xp in linux to increase vdi size

Postby alexsurender » 2. May 2008, 20:23

1.In current running winxp vm, in its details click on the hard disk.
2.In primary slave add a new vdi file to current working primary master.
3.Now start winxp vm, when os completes loading the new vdi will not be visible in my computer.
4.Goto control panel->administration tools->computer management->disk management.
5.Now u will see the new vdi hd space, right click and initialize it then windows will ask u volume name and will ask to format in ntfs.
6.Give volume name dont format, after finishing close the disk management.
7.Goto my computer u will see the new partition now format it to ntfs or fat32 and use it.
8.enjoy
9.Long live virtualbox
alexsurender
 
Posts: 1
Joined: 2. May 2008, 20:01

How-to move XP to larger drive

Postby jimrippon » 8. May 2008, 17:59

I second the feature request to be able to extend the size of a VDI file, I would prefer to be able to have a source VDI which I clone to make new machines that is only as large as it needs to be.

In the absence of this functionality I am now using the following steps to create new Windows XP machines (I am sure these would transfer to other OS's as you are only limited by filesystem support in GPARTED):

First Obtain ISO image of EASEUS Disk Copy from http://www.easeus.com/disk-copy/index.htm

Also you must Obtain ISO image of GPARTED Live CD from http://gparted.sourceforge.net/livecd.php

To clone from your smaller VDI to your new larger one:
* Attach your existing (source) VDI to primary slave
* Attach your new (target) VDI to primary master
* Attach the Disk Copy ISO to the CDROM
* Ensure CDROM is selected as a boot option above Hard Drive and start VM
* Accept default boot option
* Follow on-screen prompts once Disk Copy has started:
-- "Welcome to the Disk Copy wizard" - press Next
-- "Select copy mode" - select "Disk Copy" and press Next
-- "Select source disk" - select "Disk 1" (check sizes) and press Next
-- "Select destination disk" - select "Disk 0" (check sizes) and press Next
-- "Task preview" - Check settings and press "Proceed" when happy
-- Wait for process to finish, the press Quit to exit.
-- Host+Q and powerdown machine when completed.
* Detach your source disk from Primary Slave

To expand your cloned data to fill the new VDI:
* Attach the GParted-Live ISO to the CDROM and start VM
* Accept default boot option
* Follow startup prompts to select your preferred keyboard layout, select "vesa" graphics and select your preferred language
* Once GParted has started, select your new partition and choose "Resize/Move" from toolbar
* Stretch partition to fill drive and click "Resize/Move"
* Click "Apply" on toolbar and follow prompts
* Exit GParted and Host-Q and power off VM
* Unmount CD and ensure Hard Drive is selected as a boot option
* Start VM - all done :D

Hope this helps some of you, it works reliably for me and involves minimal downloads and disk space for ISOs - I had previously been using UBCD as it includes all the tools required, but a larger ISO image.

Jim
jimrippon
 
Posts: 1
Joined: 8. May 2008, 17:29

Migrate windows from HW disk to bigger vm - using ntbackup

Postby mattcornell » 12. May 2008, 20:45

I have for the first time in my life said "Wow that microsoft software worked exactly as I wanted it to".

ntbackup on a windows 2000 server is the bomb. And cursory review suggests that it has gotten better with xp on.

What I did was create a virtual machine with a vanilla install of windows 2000 and made sure it could see my network's shares.

Then I went to the source machine which was a real life server (800mhz and in need of upgrade) and stopped any services I could. Ran ntbackup saving the whole C: drive and the system state to a network location.

After waiting an hour for the 20 gig or so backup to finish I just shut down the real machine so that there wouldn't be any contention for it's IP address or for Domain control.

Went to the virtual machine and used ntbackup to restore from the backup image on the network (making sure to allow for the 'write over local files always' option). After another hour or so all I had to do was reboot; reconfigure the network because that device had changed and I was all set.

I image you could use the same process just to move one virtual windows server with a 20GB disk to another virtual server with a 40GB drive. It was a unexpectedly easy experience.
mattcornell
 
Posts: 2
Joined: 12. May 2008, 20:34

Postby upandgone » 10. Jul 2008, 21:53

Hey Jim,

Thank you so much for you reply. All tools are free, reliable and fast. The solution you suggested works perfectly.

Cheers

PS: Since when has XP become so big? 4 GB was much to small...
upandgone
 
Posts: 3
Joined: 14. Jun 2008, 17:40

Postby virtuoso » 11. Jul 2008, 13:21

I've been trying to resize a partition myself; however, the problem I am faced with is snapshots.

I like to use snapshots in order to someday make clones, as well as so I only need to install Windows once, e.g. when the next service pack comes out, I'll just revert to initial install and make a new branch.

BUT, if you take the approaches given here, where you attach another VDI and copy over files from the latest snapshot, VB still associates the previous VDI with your earlier snapshots. E.g. I have to keep my old 20GB (full) VDI around because I'll need it if I want to revert to a snapshot. So now I have a completely new 40GB VDI with 20GB of the same files. :x

I'm not familiar with how VB tracks changes between snapshots: do differences remain with the VDI or are kept separately?

We really need a feature to resize VDIs within VB... copying contents of VDIs doesn't appear to work with snapshots too well. I'd be willing to help develop. I haven't coded in a few yrs though so I'm probably pretty rusty :(... but good reason to get back into it. :D
virtuoso
 
Posts: 24
Joined: 29. Jun 2008, 23:13
Location: $HOME/.VirtualBox
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Win7x32

Postby virtuoso » 11. Jul 2008, 13:25

upandgone wrote:PS: Since when has XP become so big? 4 GB was much to small...


My Vista install is 20GB before I even started using the damn machine! That's incl. Office, Project, Visio, VStudio, Quicken- all the things I can't leave just yet. I know Vista doesn't compare well to XP in terms of size, but I'm still shocked at the bloat!!!!!!
virtuoso
 
Posts: 24
Joined: 29. Jun 2008, 23:13
Location: $HOME/.VirtualBox
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Win7x32

Postby MisterGoupil » 10. Nov 2008, 15:23

reptile wrote:I did this ages ago using acronis disk manager partition software.

I created a new dynamic disc and added it to the machine.

i opened up the disk manager sofware and chose to copy the partition and mbr

then it asked if i wanted it resized to fit the space and i said yes.

it worked perfectly.


Hello,

I try today with Acronis Disk Director 10.0.2.173

I had a 1st disk with one dynamic partition (letter C: Windows XP Home) of 5,25Gb and a non assigned partition of 7,844Mb created by VBox

I created a new dynamic disk of 25 Gb (max) and attached it to the VM at first Primary Slave on VM.

I have launched DiskDirector (Already installed on the first disk/partition of 5,25Gb)

I choose to copy only the 1st (too small !) dynamic partition to the new bigger 2nd dynamic partition (25Gb) ( Active with letter D:)

I resized to fit the space but limited to 25Gb minus 7,844Mb to respect the first configuration of disk1

BUT I don't copy the MBR from 1st Disk to new bigger disk/partition.

I proceed, i reboot once and i stopped the VM

After with Virtual Disks Manager, i detached the 1st Disk of 5,25Gb
And i attached the 2nd Disk of 25 Gb at first Primary master on VM

So i launch the VM and it's a success !

It's very well ! All is right ! :D
Ubuntu 8.10 Intrepid Ibex - VirtualBox 2.04 (Windows XP Home SP3)
MisterGoupil
 
Posts: 1
Joined: 10. Nov 2008, 14:31

Postby jiapei100 » 3. Dec 2008, 14:39

Yup, any solution to this question?

How to enlarge the Guest Driver size?
jiapei100
 
Posts: 14
Joined: 19. Feb 2008, 22:21
Location: England

Postby TerryE » 3. Dec 2008, 16:18

jiapei100, if you want an answer to your Q then read the previous content of this topic.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
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

PreviousNext

Return to Using VirtualBox

Who is online

Users browsing this forum: No registered users and 11 guests