increase size of virtual disk

Discussions related to using VirtualBox on Mac OS X hosts.
deeky1981
Posts: 3
Joined: 9. Oct 2008, 01:45

increase size of virtual disk

Post by deeky1981 »

How do I make a virtual disk larger once it has been defined? I have a 10GB Virtual Disk with XP on it all service packed up and with some software installed and would like to make it 40GB.

Can I either expand it? OR, Can I image the 10GB Virtual Disk to a blank 40GB then attach the 40GB drive to the machine?

Apologies if this has been posted but I haven't found it yet - seems like a reasonable request, but just can't figure it out.

I'm on OS X Leopard (also new to Mac for about 3 weeks now).

Thanks in advance,

Deacon
pvmstg
Posts: 29
Joined: 28. Jan 2008, 14:01

size change

Post by pvmstg »

Good question I had the same problem.... Looking foward to an answer.

But in case, you can make other virtual disk an use them... I do that to put the swap disk, the program disk etc... so... You can connect many disk... so do not hesitate.
deeky1981
Posts: 3
Joined: 9. Oct 2008, 01:45

Post by deeky1981 »

Well, i see what you are saying just create another drive "image file" and attach to the machine I'm using and viola - more space....

I'd rather not do that, but realize it's an option.

I think there is some type of console command that allows this, but haven't figured it out yet.

Thanks for replying - let's hope somebody can lead us to the light.

Deacon
ChrisA
Posts: 11
Joined: 12. Sep 2008, 14:09

Post by ChrisA »

I used to use Parallels and used this (link below) method to increase the VM internal partition size - worked a treat. I haven't tried it with VB yet, if you do give it a go I'd be interested to know if it works.

http://uneasysilence.com/archive/2007/01/9404/
vkov_tinsky
Volunteer
Posts: 218
Joined: 5. Apr 2008, 20:18

Post by vkov_tinsky »

Hi,

You could try something like this (see also Tutorial - All about VDIs: How can I resize the partitions inside my VDI?):
  1. Create a new VDI of the desired size.
  2. Boot GParted Live in a VM with both old and new VDIs attached.
  3. Check in the partition editor (opened automatically after booting) what your old and new disk locations are. (It'll be something like /dev/hda and /dev/hdb.)
  4. Copy contents from old to new disk. This will take a fair amount of time. (Here /dev/hdX is your original disk and /dev/hdY the new one).

    Code: Select all

    dd if=/dev/hdX of=/dev/hdY
    [/size]
    • Warning: Make sure you do not mix up your input and output disks or you'll wipe all information from your original disk! (if= specifies the input and of= specifies the output.)
  5. Reboot (again with GParted-Live). Now you should be able to increase the Windows partition size on the new disk.
Once you've verified the larger VDI boots Windows fine (and disk size is as you'd expect) you can of course delete the old smaller VDI.

Edit: Instead of rebooting before you resize the partition you should be able to run partprobe and the hit CTRL+R in GParted instead.

Regards,
VT
deeky1981
Posts: 3
Joined: 9. Oct 2008, 01:45

problem solved

Post by deeky1981 »

vkov_tinsky,

You are a genius. Nice procedure and worked like a charm.

It took approximately 20 minutes to move 7 gigs of data using your method as you said it would.

ChrisA - I did not try your solution - but after reading it looks like an extremely similar procedure.

Can't thank you(s) enough.

Deacon
vboxuser799
Posts: 111
Joined: 20. May 2009, 09:43
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows 10

Re: increase size of virtual disk

Post by vboxuser799 »

Please forgive me if I'm in the wrong place to ask this. I have tried to search the forums and the manual, but not being a computer geek, I'm in over my head.

My XP guest has a 40GB virtual drive, but I need to make it bigger (5 GB is left). Is there a reasonably easy way to do this without major risks or going to computer science classes? :) Everything I found on the forums seems old (pre version 4 of VB). I see there's some kind of utility that is supposed to do this, but the site (https://github.com/przemoc/vidma) says it's only alpha and not necessarily safe. This site (http://trivialproof.blogspot.com/2011/0 ... 9862927608) is post v. 4, but it says to use the vboxmanage command line system (have installed on your system), and I don't know what that is or how to use it (Start > Run ??).

If someone would be kind enough to walk me through this, I'd really appreciate it. Thank you.

Specs: MacBook Pro Penryn (4,1; early 2008; Model Number A1260), 2.4GHz, Core 2 Duo, 4 GB RAM (1.5 of this goes to Windows VM), running Snow Leopard (10.6.8) [that's 10 dot 6 dot 8, but smilies keep changing the final digit]; Virtualbox v. 4.1; Windows Win XP SP3 guest is allocated 1.5 GB RAM of the total 4GB RAM on the Mac machine and has a 40GB "Normal" (VMDK) virtual drive.

edit: clarify Mac OS X version due to smilies interfering
SemiTech
Posts: 3
Joined: 10. Sep 2011, 06:08
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows 7 x86

Re: increase size of virtual disk

Post by SemiTech »

I finally succeeded in increasing the size of my Windows 7 virtual hard drive. It was a multi-step process.

First, I used the Mac's Time Machine backup system to restore the files in my VirtualBox folder to a time and state before I attempted to increase my virtual hard drive size. This was also a time before I deleted one of two snapshots. The goal was to be able to delete all snapshots or merge them into the current state. I believe you can't extend the size of your virtual disk with snapshots around.

Using Time Machine (or back up of your choice) I restored all snapshots, vdi, and xml files to the earlier time.

After these files were restored, I used the VBoxMange GUI to delete the newest of the snapshots (do not do this in the Mac Finder!). Then, from the VBox Manage GUI, I restored the Windows VM to the first, oldest, snapshot. Thus, the new "current state" became that of the first snapshot, which is what I wanted. Thus, no more "snapshots" - only a current state.

With only the "current state" showing in the VirtualBox Manager, I now used the command line tool, VBoxManage, with the modifyhd command. Consult the VirtualBox PDF help manual, Chapter 8, on usage.

VBoxManage modifyhd <path to vdi> --resize 40960.

VBoxManage reported success, but the disk size didn't change in Windows (as reported in the Computer window).

This is where I had to use the built-in Windows utility called DISKPART. In the Windows search box type "run" to get a command line window, then type DISKPART. Use the DISKPART utility to extend (expand) the volume or partition with focus, and its file system, into the free (unallocated) space on a disk.

Type DISKPART "help extend" for a manual-like help file on using the DISKPART tool. At the end of the help you will see an example code for extending (expanding) your disk space.

Example:
EXTEND SIZE=40960 DISK=0
EXTEND FILESYSTEM

You must have previously selected (DISKPART>select volume or disk) a volume or partition for this to work. Use DISKPART>list disk and DISKPART>list disk to see your disks and volumes before taking any action. (I believe that I selected the volume before using the EXTEND commands.)
taufik
Posts: 1
Joined: 17. Oct 2011, 07:34
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Debian

Re: increase size of virtual disk

Post by taufik »

just run..

Code: Select all

VBoxManage modifyhd Compiler.vdi --resize 10240
For resize to 10240 MB
mrrvb
Posts: 2
Joined: 27. Oct 2011, 12:16
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows 7 and XP

Re: increase size of virtual disk

Post by mrrvb »

An additional note on SemiTech's entry on 20 sept 2011 to make life easier...

I just have increased my virtual hard disk of my virtual windows xp machine on mac os x Lion with VirtualBox 4.1.4.

1). I did not do anything beforehand with the snapshots. (I do not even know what that are...).
2). I just used the modify hd command, but noticed that I had to enter the full path name of the vdi file. This is a known "error" in VirtualBox according to many people... (I do not not if it is adjusted in the manual already). N.B. users of non english versions of OS X: if the file is in the library, use the word library in stead of the translation, e.g. /Users/[Short user name]/Library/......
3). After a successful execution of step 2 (just seconds) and start up of Windows XP the hard disk space has indeed not gotten bigger yet. The partition within Windows XP needs to be enlarged with the extra created space in VirtualBox. But there is a far more simple way to do this in Windows XP: download EaseUS Partion Master (it's free). Just read the explanation on extending the disk (= resize/move part ion task). Look carefully on which line the cursor is at. Everyone can do this!

Hopefully this helps people with a little less IT knowledge (like me).
tabz
Posts: 2
Joined: 4. Nov 2011, 22:42
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Windows XP

Re: increase size of virtual disk

Post by tabz »

Hi this is a question for mrrvb and SemiTech

Could you explain where I go to run the modify hd command? Is it somewhere on the Mac or is it in Virtual Box? I'm using a Windows XP guest on a Mac OSX 10.6.6 host with Virtual Box 4.0.12. I'm trying to increase the size of my virtual machine from 10GB to 40GB as I only have one copy of the software I need to use and it's installed on there - wish I'd made it bigger beforehand!

Thanks very much in advance. I am not very good at this stuff so would appreciate your help!
:D tabz
tabz
Posts: 2
Joined: 4. Nov 2011, 22:42
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Windows XP

Re: increase size of virtual disk

Post by tabz »

Hi an update - I located Terminal in the Applications/Utilities folder and tried running the command

VBoxManage modifyhd Windows XP Hard Disk.vdi --resize 40960

It didn't work unfortunately. It said 'invalid parameter XP' or something like that. Is this something to do with the way I've named the disk?

Also, I hadn't deleted the snapshots on the Windows XP guest machine as it describes doing here

http://trivialproof.blogspot.com/2011/0 ... on_new_vdi

linking to these instructions

http://srackham.wordpress.com/cloning-a ... _snapshots

Is it necessary to delete the snapshots, and is it safe? I've tried saving a snapshot of the current state, and deleting/merging that, but it made me very nervous!

Any help gratefully recieved. Thanks! tabz :)
cbramich
Posts: 1
Joined: 5. Nov 2011, 15:52
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win XP, Linux (various)

Re: increase size of virtual disk

Post by cbramich »

VBoxManage modifyhd Windows XP Hard Disk.vdi --resize 40960
You'll need to escape the spaces in the drive filename:

VBoxManage modifyhd Windows\ XP\ Hard\ Disk.vdi --resize 40960

or

VBoxManage modifyhd "Windows XP Hard Disk.vdi" --resize 40960

Also remember that you'll need to increase the size of your Windows partition on the disk, or create an additional partition in the new space.

[and hello everyone, I'm new here]

CB
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows, OSX
Location: U S of A

Re: increase size of virtual disk

Post by ChipMcK »

For those with Widows XP guests, the following products will safely grow/expand the partition AFTER the virtual hard disk file has been expanded
http://www.partitionwizard.com/free-par ... nager.html
http://www.partition-tool.com/
http://www.paragon-software.com/home/pm-express/

All are free and are to be installed in Windows

Best!
dunion
Posts: 3
Joined: 3. Jun 2011, 18:04
Primary OS: MS Windows 7
VBox Version: OSE Debian
Guest OSses: Win7 x64

Re: increase size of virtual disk

Post by dunion »

You can just use computer management/disk management, right click on the partition and select 'extend' to extend the partition once you have used the VBox command line to make the disk larger, you don't need any third party tools, this is now built into Windows.
Locked