Page 1 of 1

resizing a vdi file

Posted: 2. Jul 2011, 10:15
by mahmood
Hi
I have installed virtualbox 4.0 on windows 7 as host machine and also installed a guest linux (ubuntu 10.10). Now I want to resize the vdi file.
I have read that this command will resize a vdi file

Code: Select all

F:\lubuntu10.10>"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd --existing lubuntu.vdi lubuntu-new.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: a2681bc4-801a-4b65-af4d-802624934
9f6
After I boot into linux, I see the old size in linux. Any idea about that?

Re: resizing a vdi file

Posted: 2. Jul 2011, 11:39
by mpack
Use gparted to resize the old partition which is still on the disk.

Re: resizing a vdi file

Posted: 2. Jul 2011, 15:42
by mahmood
Are you sure?
As I said, I have created a 20GB vdi file (which represent a hard disk and not partition) and I now want to increase that to 80GB. Gparted doesn't do that. Because it says you can increase your partition ( / for example) up to 20GB.

Re: resizing a vdi file

Posted: 2. Jul 2011, 15:56
by Sasquatch
You cloned the VDI to a new file. What do you expect to happen with that? You get a file that's the same as the original. A clone isn't bigger or smaller in any way. Want to increase the maximum size of a VDI, the virtual hard disk, then read the User Manual and learn how to resize it. THEN you have to use gparted because you just increased the disk size, not the partition(s) on it.

So, you are the one that's wrong. Mpack is very knowledgeable about this subject, so I advise you to never question him when it comes to this subject ;).

Re: resizing a vdi file

Posted: 2. Jul 2011, 17:06
by mpack
Ah, actually I misread your first message: quickly scanning your writing I saw that you had used VBoxManage and my mind filled in the rest, assuming you had used the correct VBoxManage command (modifyhd), hence only the gparted step remained. Returning to it now with more time, I see that all you did was clone the VDI - and as Sasquatch said, cloning just gives you a copy with no changes.

The proper steps are :-

1. Make a backup copy of your VM in case you mess up.

2. Virtual drives with snapshots can't be resized, so you must get rid of the snapshots. This can be done in one of three ways :-
(a) Don't use snapshots in the first place (hopefully this describes your normal policy).
(b) or, delete all the snapshots using the GUI (this causes the data to be merged into the base VDI).
(c) or, use the cloning command you already discovered to clone the latest snapshot, again this creates a merged VDI.

3. Enlarge the virtual disk using the "VBoxManage modifyhd <disk name or UUID> --resize n". See user manual for exact syntax.

4. Attach VDI to a VM, boot VM with a gparted live CD, and enlarge the partition to fill the drive.