Jump to content

Can you make a fixed VM bigger in VirtualBox?


ichase

Recommended Posts

Ok, I run 3 flavors of Windows in VM on my Arch host laptop as well as my work laptop. These are all for my job. Windows XP, Windows 7, and Windows Server 2008. (As well as multiple Linux flavors for fun)

 

I make all of my VMs as fixed size. My XP (which was my first VM I created using VBox) I set as 20GB. Now, In most cases, I still use the XP VM because it is set to 2 GBs of RAM and for some reason, things just work better in XP then they do in 7 or Server 2008. Problem I have ran into over the last couple of years, is I only have about 1 GB left of space on this VM. I do share folders from my host and use them often to store things but OS's just have a way of growing no matter what you are using.

 

OK, enough with the bloviating. My question is (Ray) :hysterical: Is there a way to change the "fixed size" of the VM from let's say 20GB to 40GB and not loose the integrity of the VM the way it is currently set up now? I know I could start from scratch and re-install but let's face it. We ALL set up our OS's a certain way that is comfortable for us and that is normally something that takes months even years because we "STILL" like to play with OS's and "tweak" them, change "themes".....The list goes on and on. :thumbsup:

 

And yes, with all jokes aside, I do thank you and much appreciate any guidance you can provide.

 

***I have looked in Google and have read a lot of different things and most were different and ALL were somewhat confusing. ;)

 

All the best,

 

Ian

Link to comment
Share on other sites

Haven't tried this but here's a link:

 

http://www.howtogeek...lbox-or-vmware/

 

Looks like you have to do it in two steps:

  • Use VBoxManage on the host to make the guest HD larger. (This is a Windows host but I'm sure the same approach would apply in Linux...just a different path.)
  • Use a disk partition app like GParted on the guest to expand the guest partition to take up your newly created space.

What I usually do is give myself a 40GB HD on setup and then simply let the HD expand as needed.

 

I'd make sure to back up your current drive before you try anything. (But you already know this I am sure.)

Edited by raymac46
Link to comment
Share on other sites

Thanks Ray,

I am currently (as I do weekly) taking a snapshot of my 20 GB Windows XP (32 bit) vdi and I am currently making a 40 GB vdi with a different name. Going to let that finish and move on from there. If I understand the directions properly, you will create the "NEW" vdi as the size you want (in my case 40 GB) and as a Windows XP (32 bit) but WILL NOT install XP on it. Just boot into Clonezilla (or Parted Magic) on the newly created vdi and start going from there. I will let you know how this goes. :thumbsup:

Edited by ichase
Link to comment
Share on other sites

Hedon James

You can do this from the commandline terminal Ian.

 

http://www.howtogeek.com/124622/how-to-enlarge-a-virtual-machines-disk-in-virtualbox-or-vmware/

 

I have successfully enlarged a 20GB disk for a WinXP VM to a 50GB disk using this method. I have also used Ray's method successfully on a Win7 VM. In both instances, my disk size was dynamic, not fixed, but I don't think it matters. Your VM disk size is "reserved" on the host; fixed just reports the entire disk area as used to the host, while dynamic just reports the used area of the disk to the host.

 

Either way, it can be done. Good luck Ian!

  • Like 1
Link to comment
Share on other sites

Hedon James, thanks for the tip, can you give me a tip on how to do with the host being Linux. I tried to do it this way:

[root@arch64 WinXP_Pro]# VBoxManage modifyhd "WinXP_Pro.vdi" --resize 40960
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

It appears as if (from what I have read) that this is not supported on a "fixed size" VM?

 

Any suggestions. I created a 40GB VM, booted into Clonezilla but was unable to go any further then the login screen. I'm obviously doing something wrong as it would seem like if this works in a Windows Host (as the link describes) it would work with a Linux host?

 

Trust me, I am the FIRST to admit, it's probably something "I" am doing wrong :hysterical:

 

Thanks in advance,

 

Ian

Link to comment
Share on other sites

Hedon James

Hedon James, thanks for the tip, can you give me a tip on how to do with the host being Linux. I tried to do it this way:

[root@arch64 WinXP_Pro]# VBoxManage modifyhd "WinXP_Pro.vdi" --resize 40960
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

It appears as if (from what I have read) that this is not supported on a "fixed size" VM?

 

Any suggestions. I created a 40GB VM, booted into Clonezilla but was unable to go any further then the login screen. I'm obviously doing something wrong as it would seem like if this works in a Windows Host (as the link describes) it would work with a Linux host?

 

Trust me, I am the FIRST to admit, it's probably something "I" am doing wrong :hysterical:

 

Thanks in advance,

 

Ian

 

Hmm, couple of possibilities here. First comment is that I'm not sure if you need to be root, although I understand it's a good practice. On my Ubuntu system, I just preface "sudo" to the terminal comman. Probably 6 of one, half dozen of another. My first question is regarding your root prompt 'root@arch64 WinXP_Pro#'. Is "arch64 WinXP_Pro" the name of your linux host? Or is "arch64" the host and "WinXP_Pro" the path to your VDI?

 

If you have navigated directly to the directory path for the operation, I believe you can do away with the quotes, such that your terminal command is this:

 

VBoxManage modifyhd WinXP_Pro.vdi --resize 40960

 

If you are at your main directory, the entire directory path after 'root@arch 64' should be in quotes, such that your terminal command is this:

 

VBoxManage modifyhd "WinXP_Pro/WinXP_Pro.vdi" --resize 40960

 

I'm not sure if the above is just semantics at the command line, or whether it's an important distinction in the operation. FWIW, I did this from my default home path location and used the 'sudo VBoxManage modifyhd "path/to/directory/vdi_file" --resize 40960' method. If neither of these alternatives work, I'm inclined to say that Ray's diagnosis of fixed disk vs dynamic disk is probably the culprit.

 

IMO, I would follow Ray's link to convert the disk to a dynamic disk size, then try the above again to resize. If the above resize doesn't work, the Clonezilla method or even a gPartEd method to copy partitiion onto the new, larger disk should work, followed by expansion of the partition to the entire disk. I don't know why Clonezilla would hang at boot, but assuming a newly created and larger 40GB disk has been attached as a slave to your VM, another alternative would be to temporarily attach a linux ISO file as a cd image to your WinXP VM and boot from the VM cd image. You could then use the disk druid "dd" terminal command to copy the existing 20GB disk onto the 40GB disk. Using gPartEd from the LiveCD, be CERTAIN you have appropriately identified the hard drive device names of your VM. I am assuming that your 20GB drive will be /dev/sda and your new 40GB drive will be /dev/sdb. Under these assumptions, you would type this from the LiveCD command line:

 

dd if=/dev/sda of=/dev/sdb bs=4096 conv=notrunc,noerror,sync

 

Here is a more detailed tutorial I found on the Arch Wiki (note the section "cloning an entire hard disk")

https://wiki.archlinux.org/index.php/Disk_Cloning

 

Anything else mentioned in that Wiki is something I haven't attempted yet, just FYI! I know this sounds like a PITA, but once you're successful, I'll bet that it was still quicker than creating a new larger VM and tweaking it the way you like it. Besides, I'm not sure you'd get all the service pack updates and patches through April 8, 2014 that a new install typically requires anymore?

Link to comment
Share on other sites

securitybreach

I was just wondering why you decided to use a fixed size? I always set mine to fill up as needed as dynamic. I usually end up using less space that way anyway.

Link to comment
Share on other sites

Sorry for the long wait in replying and again THANK YOU to Hedon James and Raymac for your assistance. Life continues to get in the way so have NOT had any more time to work on this.

 

I was just wondering why you decided to use a fixed size? I always set mine to fill up as needed as dynamic. I usually end up using less space that way anyway.

You are absolutely correct. That is what I SHOULD have done, but figured a fixed size with what limited HDD space I had left would be best. Now that I know I can run ALL of my .vdi files (the large ones) directly off of an LARGE external drive I won't be doing that any more. Live and learn contantly :thumbsup:

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...