resizing a vdi file

Discussions related to using VirtualBox on Windows hosts.
Post Reply
mahmood
Posts: 29
Joined: 26. May 2010, 09:24
Primary OS: Ubuntu 8.04
VBox Version: OSE Debian
Guest OSses: windows

resizing a vdi file

Post 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?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: resizing a vdi file

Post by mpack »

Use gparted to resize the old partition which is still on the disk.
mahmood
Posts: 29
Joined: 26. May 2010, 09:24
Primary OS: Ubuntu 8.04
VBox Version: OSE Debian
Guest OSses: windows

Re: resizing a vdi file

Post 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.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: resizing a vdi file

Post 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 ;).
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.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: resizing a vdi file

Post 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.
Post Reply