26th Jul2012
Author: Gyro

Resize VirtualBox Disk Image – grow, expand, increase a .VDI disk image in 1 minute

Resize VirtualBox Disk Image -- the easy and the hard way.Today I actually used up the 20GB of virtual disk space I set for the Windows XP I use for specific Windows Software. Who would have thought that an old Windows XP license would be useful again, eh? :)

After performing a quick search on how to manipulate an existing VDI file, I found a bunch of lengthy guides, all pretty much saying the exact same thing… create a new VDI, load the old and new VDI disk images into a Virtual Machine as a master and slave drive, boot with a gParted or equivalent BootCD image, and then clone the old disk to the new one… or in short: do a lot of steps that take forever, but not what I want: Resize VirtualBox Disk Image.


After flipping through the 10th or so guide, I realized that pretty much all of them were written in 2008… very unusual as bloggers usually write about the same subject on a yearly basis. That in mind, I search a bit more and… BINGO! Since VirtualBox 4 is out, there is a simple command line tool to resize VDI images. Man, those extra 5 minutes of searching just saved me from a lot of hassle and a huge waste of time.

Since I want to pass on this crucial bit of information, I hope mentioning that this article is about how to resize VirtualBox Disk Image in 1 Minute! will help to put this post up on the first page in google for people searching for this simple solution, and don't think they have to go through all those steps mentioned in other guides on how to change the size of a vdi disk image file… your help in spreading the word about this article featuring a super easy way to resize VirtualBox disk image is very much appreciated :)

You CAN NOT resize a snapshot .vdi file.
If you use snapshots, you need to DELETE all of them before resizing the .vdi OR you could clone the latest snapshot .vdi to a new .vdi (automatically merging all existing snapshots into one): # VBoxManage clonehd fullpath/{uuid-of-last-snapshot}.vdi the-new-disk.vdi and link "the-new-disk.vdi" to your virtual machine.
If you use VirtualBox Version 5, some syntax has changed. Please check near the bottom of the comment section to find out the correct command.

This is for VirtualBox Version 4 running on Linux, Mac, and Windows. I found the Mac solution in the comments, and there may be some more tips I may have missed to add here.


Using Windows as a Host
Open the command prompt and enter:
# C:\Program Files\Oracle\VirtualBox\VboxManage.exe modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB

Using Mac as a Host
open a Terminal session (not sure if that is what it is called in Mac, hehe) and type:
# /Applications/VirtualBox.app/Contents/MacOS/VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB

Using Linux as a Host
open a Terminal session and type:
# VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB

YOUR_HARD_DISK.vdi could be something like:
"C:\Virtual Boxes\Windows XP\Windows XP.vdi" OR
/Users/username/VirtualBox VMs/Litter/Litter.vdi OR
/home/username/VirtualBox\ VMs/WindowsXP/WindowsXP.vdi
SIZE_IN_MB would be 30000 for 30GB
If you get an error mentioning the VirtualBox COM server, start the VirtualBox Dashboard and make sure you have Administrator rights (command prompt as Administrator / not sure about Mac / sudo in Linux), then try again.

An alternative to using the path to the vdi file
open a Terminal session/command prompt and type:
# VBoxManage list hdds
you will see something like this:
UUID: 5ebf0266-4e9e-4b7e-b9f6-6d67514919c3
Using the above as an example:
# VBoxManage modifyhd 5ebf0266-4e9e-4b7e-b9f6-6d67514919c3 --resize SIZE_IN_MB

And that's already all there is to it… I just wish they would include this in the GUI.

Note: You probably need to grow the partition to take up the space of the resized .vdi, look below and in the comments for some suggestions :)
If you have Linux installed as a guest, do this:
# sudo resize2fs /dev/sda1
If you get a message along the lines of: "filesystem is already x blocks", then you need to follow my comment from August 22, 2013 08:30
Here is probably the easiest way to grow the partition while Windows (7, Server 2008 R2, or newer) is running on the VirtualBox Guest.
Using Windows Guest System:
1. Right-click Computer and select Manage.
2. Double-click Storage.
3. Double-click Disk Management.
4. In the list, right-click the partition to expand and select Extend Volume.
5. Follow the prompts to resize the partition and click Finish. The partition item in the Disk Management pane displays its new size.
6. Close the Computer Management window

Should you be using a VirtualBox version older than VirtualBox 4 and are looking for a way to resize a VDI VirtualBox Harddisk file,  here are the articles I flipped through but luckily did not have to follow:

Increase the size of a .vdi file


Resize VirtualBox Disk Image vdi files to bigger size


How to Resize a VirtualBox vdi file


Expand vdi virtualbox disk image


Grow a virtual drive, vdi Virtual box disk image

Source of the easy way:


Keep Me Going
Your Name / Website:
Did you like my post? Buy me a Bitcoffee! 14JX52Li7zTKbyQv2omw4tvu6Bi1KzfHNW

143 Responses to “Resize VirtualBox Disk Image – grow, expand, increase a .VDI disk image in 1 minute”

  • Justin

    Thanks heaps, that really helped!

    • Gyro

      You are very welcome, glad my posts also help someone other than me :)

      The reason I started this site is so that I don’t have to search for the same things over and over again…

  • Marco

    Do you know if you can resize back?
    I did a mistake, i resized it to 7TB and not 7GB, now i’m not able to open it. please let me know if is possibile to go back.

  • kellu

    And what about windows solution?

    • Gyro

      Good question… I didn’t even know VirtualBox runs on Windows… how about installing Ubuntu on another VirtualBox, then installing VirtualBox on the Ubuntu and use it to change the vdi file? :)

    • Jerry

      I was able to resize in Windows by opening a Command Prompt, and navigating to the VirtualBox folder where the VboxManage.exe executable is located. Like so:

      cd “Program Files\Oracle\VirtualBox”
      VboxManage.exe modifyhd –resize

      You may(?) have to launch the Command Prompt with the “Run as Administrator” option.

      • Jerry

        Part of my last comment was stripped out. The VboxManage.exe line should read like this:

        VBoxManage modifyhd YOUR_HARD_DISK.vdi –resize SIZE_IN_MB

        …just like Gyro said in his post. I tried using “” characters around the variable parts, but they were stripped out entirely upon hitting “Post Comment”.

        • Gyro

          I will add your solution to the OP, so other Windows users don’t have to search the comments, and I will have a look at a better comment editor that gives you the option to post code without characters getting stripped out.

          Thanks a lot for posting this solution!

          • rocko

            Well for me worked this command:

            c:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd -filename “c:\Users\r
            ocko\VirtualBox VMs\ubuntu\ubuntu.vdi” –resize 10000
            Oracle VM VirtualBox Command Line Management Interface Version 4.2.18
            (C) 2005-2013 Oracle Corporation
            All rights reserved.


            VBoxManage modifyhd
            [–type normal|writethrough|immutable|shareable|
            [–autoreset on|off]
            [–resize |–resizebyte ]

            Syntax error: unknown option: -filename

            c:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd –resize 10000 “c:\Us
            ers\rocko\VirtualBox VMs\ubuntu\ubuntu.vdi”

            c:\Program Files\Oracle\VirtualBox>

            Mabe this will be helpful for someone, I’m not sure if it’s because of new version VBox or what :)

            Anyway, great thanks for that solution!

          • Gyro


            thanks for the information, but where did find the first command that you tried? “–filename” is not being used/mentioned anywhere in this post or the comments (until now)… it seems to come from another site (the operators are also in a different order).

            Glad you got it sorted though :)

  • Marek

    Hi Gyro, thanks for hint with VBoxManage command. I’ve resized .vdi file and VBox GUI display correct size (10GB) in Storage>Information section is Virtual size 10GB but Actual Size is 6.8GB. Problem is that windows hosted in VBox has detected only 6.8GB drive and this is not resized anyhow. Please don’t you know how exactly VBox dynamicaly alocate drive resize? I’m not able to extend Actual Size.

  • Marek

    Hi Gyro, I think I found what will need to do inside the hosted system. In VBox User Manual in section 8.23. VBoxManage modifyhd – paragraph for -resize parameter:

    The –resize x option (where x is the desired new total space in megabytes) allows you to change the capacity of an existing image; this adjusts the logical size of a virtual disk without affecting the physical size much.[37] This currently works only for VDI and VHD formats, and only for the dynamically allocated variants, and can only be used to expand (not shrink) the capacity. For example, if you originally created a 10G disk which is now full, you can use the –resize 15360 command to change the capacity to 15G (15,360MB) without having to create a new image and copy all data from within a virtual machine. Note however that this only changes the drive capacity; you will typically next need to use a partition management tool inside the guest to adjust the main partition to fill the drive.

    …there is noticed to extend disk partition which make a sense, but I had no such idea till I see it in guide.

    • Gyro


      you are right, thanks for mentioning it.

      There are a lof of free partition managers out there… when I look for Windows software I usually ask google like this:

      “sourceforge partition manager” or “sourceforge type-of-app”, I usually find what I was looking for on sourceforge, so why install closed source, even if it is free? :)

      Now why do some comments have dark text?! I need to do some css changes, I guess.

  • Natt

    Thank you, that was a massive help! Win7 + 9Gb of Outlook ost’s really don’t like to fit on a 30Gb disk…

    • Gyro

      Thanks for your comment, I am happy you found what you were looking for, that’s why I made this site ;)

    • Max

      Having moved back to a decent OS (various Linux distros) almost nine years ago, I no longer use Windows except for just two or three small apps via VirtualBox and XP, but I know from (bitter) personal experience that running Outlook with .ost files that are much larger than around 500MB makes Outlook run like a slug on Demerol! My solution was to create multiple archive .ost files (still have them!!) and then open them up ONLY IF and when actually required. Don’t forget to shut them down afterwards too. You’ll find Outlook becomes a lot snappier and starts and closes far quicker (obviously).

  • Al Cellier

    You may want to mention that after increasing the size of the vdi, one needs to REPARTITION to make the new space become part of the initial drive. Take a look at ParagonPartMgr, it is free and easy.

  • Reynaldo Abimael Aceves Chamosa

    It worked for me on Mac 10.7.5 – Virtual Box 4.2.6 r82870
    MacBook-Pro-de-Reynaldo:Litter abimac$ pwd
    /Users/abimac/VirtualBox VMs/Litter
    MacBook-Pro-de-Reynaldo:Litter abimac$ ls -l
    total 31290944
    -rw——- 1 abimac staff 12446 Jan 10 20:02 Litter.vbox
    -rw——- 1 abimac staff 12598 Jan 8 11:37 Litter.vbox-prev
    -rw——- 1 abimac staff 16020209664 Jan 10 20:01 Litter.vdi
    drwx—— 6 abimac staff 204 Jan 8 10:01 Logs
    drwx—— 2 abimac staff 68 Jan 8 10:02 Snapshots
    -rw——- 1 abimac staff 720896 Jan 8 11:36 externo.vmdk
    MacBook-Pro-de-Reynaldo:Litter abimac$ /Applications/VirtualBox.app/Contents/MacOS/VBoxManage modifyhd Litter.vdi –resize 20000
    MacBook-Pro-de-Reynaldo:Litter abimac$
    Thank you!

  • Danny Brown

    Thanks – this little gem saved me hours!! Thanks

  • ProfessorX


    upsizing works the same way under windows, open command prompt, change directory to %systemdisk%\Program Files\Oracle\VirtualBox and follow the steps from as given in the post. Thanks for sharing this, Gyro!


  • Dozinoff

    This VMWare help page describes the process for live expanding a VM’s single partition while booted into Windows – turns out you can do this in Disk Management trivially:


    • Gyro


      Much easier than having to use/install a partition manager to expand the size of a Windows partition to the new size of the VDI image.

      Can’t get any easier in Windows than that… I will add it to my post.


  • Cal

    This is exactly what I was looking for and worked perfectly!!! I was in the same situation think I would be hours cloning my vdi. This saved sooooo much time and effort. Thank you!! vbox must integrate this feature into the GUI.

  • Christian Salway

    Excellent! Love people who find one liners to achieve something.

  • Abigail

    This didn’t initially work for me. I found out that I had to delete all the snapshots the virtual machine has, THEN attempt to resize the VDI image in order for it to work.

    If you happen to attempt to resize a VDI image before deleting all of your snapshots, you better have backups of the virtual machine’s files + any xml files before your attempt to save yourself a lot of trouble (located in ~/.VirtualBox on Linux).

    • Gyro

      I never worked with Snapshots… thanks a lot for sharing, I may add that to the top as a warning before starting to do anything :)

  • cuq


  • Gustavo

    I can not resize the Disk, I want to decrease it up to 20 GB as it currently is 100 GB:

    VBoxManage modifyhd /home/gustads/VirtualBox_VMs/Windows_XP/Windows_XP.vdi –resize 20000
    VBoxManage: error: Could not find file for the medium ‘/home/gustads/VirtualBox_VMs/Windows_XP/Windows_XP.vdi’ (VERR_FILE_NOT_FOUND)
    VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium, callee nsISupports
    VBoxManage: error: Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())” at line 178 of file VBoxManageDisk.cpp

    • Gyro

      I can only guess, but it looks like you are using the wrong path:
      BoxManage: error: Could not find file for the medium ‘/home/gustads/VirtualBox_VMs/Windows_XP/Windows_XP.vdi’

      A space in a folder name needs to have a backslash infront of it, it looks like you replaced it by an underscore. Try this:
      VBoxManage modifyhd /home/gustads/VirtualBox\ VMs/Windows_XP/Windows_XP.vdi –resize 20000

      If the 2 underscores from Windows_XP are also space, then do this:
      VBoxManage modifyhd /home/gustads/VirtualBox\ VMs/Windows\ XP/Windows\ XP.vdi –resize 20000

      Make sure you resize the partition in Windows XP to 20GB, before trying this. The vdi is a container, changing its size will not change the set partition size of the Guest OS installed within it. An even safer way would be to resize the partition of the Guest OS to 18GB, then expand it to the max possible size after you resized the vdi file. How to expand a partition to the maximum space available using Windows is described in a comment further up.

      Good Luck, and thanks for your comment :)

  • Gyro

    20,000+ views. I am very happy that this post has helped so many people.

  • Florian

    Thanks man, saved me plenty of time too!

    Best regards from AUSTRIA

  • Faisal Amin

    Great. Thanks very much.

  • Dan

    Here’s a tip – if it’s a “fixed size” disk you need to first clone it to a “standard” disk as you can’t resize fixed size disks.

    Use the VBoxManage utility with “clonehd -variant Standard” – this will create a copy (it takes a while) – then resize the cloned disk. Then change your VM so that it uses the new, cloned and resized disk. If you want a fixed disk again then clone the disk back using “-variant Fixed”.

  • Jose L.

    I’m having trouble resizing the .vdi file, I don’t know what am I typing wrong….
    a) First I locate the “VBoxManage.exe” file. According to this I type at the cmd prompt (previously been first
    at “C:/”):

    cd program files\oracle\virtualbox “with this line I am at the VIRTUALBOX directory, where
    VboxManage.exe is located”

    b) Secondly i type now the resizing command (I’m on the VIRTUALBOX directory):

    VBoxManage.exe modifyhd C:\Users\MYUSERNAME\Virtualbox VMs\Windows XP SP3 II\Windows XP
    SP3 II.vdi –resize 15000

    And I get this message:

    Syntax error: Invalid parameter ‘VMs\Windows’

    Please help! Would appreciate fast answer o answers!

    • Gyro

      The problem is the empty spaces… I am not sure how to do this in Windows, I assume putting it in quotes should work.

      Try this:

      VBoxManage.exe modifyhd “C:\Users\MYUSERNAME\Virtualbox VMs\Windows XP SP3 II\Windows XP SP3 II.vdi” –resize 15000

  • geminiman7

    Argh! Received the following error:

    C:\Program Files\Oracle>VirtualBox\VBoxManage.exe modifyhd H:\virtualMachines\VM
    Workstation.vdi –resize 50000
    VBoxManage.exe: error: Failed to create the VirtualBox object!
    VBoxManage.exe: error: Code CO_E_SERVER_EXEC_FAILURE (0x80080005) – Server execu
    tion failed (extended info not available)
    VBoxManage.exe: error: Most likely, the VirtualBox COM server is not running or
    failed to start.

    Not sure what that means. Any feed back welcomed!


    • geminiman7

      A step closer. Thought I deleted the .virtualbox folder but noticed it under C:\Users\Username\.virtualbox. Ran the command again but now getting this error. This doesn’t look good…

      C:\Program Files\Oracle>VirtualBox\VBoxManage.exe modifyhd H:\virtualMachines\VMWorkstation.vdi –resize 50000
      Progress state: VBOX_E_NOT_SUPPORTED
      VBoxManage.exe: error: Resize hard disk operation for this format is not implemented yet!

      Not sure what “…not implemented yet” means!

      • Gyro

        have a look at Dan’s comment, I am guessing you have a “fixed size” disk and need to first clone it to a “standard” disk.

    • Scott Savett

      I had this same problem when I tried to run VBoxManage.exe from an elevated command prompt on a Windows 7 Pro 64-bit host. When I ran it from a normal command prompt, it worked as expected.

  • Cesar

    Great tip, It works super.
    Thank a lot.

  • Rob

    Really awesome tutorial. All i knew was the lengthy process of creating a new VDI and moving the image over to it.

    Never knew it was that easy and it happened within 1 second !!

    You saved a lot of my time, thanks!

  • Martijn

    Doesn’t work.

    In VirtualBox the disk is in fact reported as the new size, but when starting it, the disk is the original size still.
    I’M NOT TALKING ABOUT THE PARTITION, just to be safe. The actual physical disk “/dev/sda” is not resized.

  • Thanks for this great Tips!!! I had some problems before managing to expand the VDI, maybe I can help someone. I can confirm that before resizing a fixed size VDI it has to be converted to dynamic with the command

    VBoxManage clonehd “Windows 8.1 (Preview).vdi” “Windows 8.1.vdi” –variant Standard (this is my case)

    I encountered another problem at this time:

    VBoxManage.exe: error: Failed to create the VirtualBox object!
    VBoxManage.exe: error: Code CO_E_SERVER_EXEC_FAILURE (0x80080005) – Server execution failed (extended info not available)
    VBoxManage.exe: error: Most likely, the VirtualBox COM server is not running or failed to start.

    I solved this by starting the VirtualBox GUI as administrator on my Windows 8, and repeated the clone command.

    Then i was able to resize the VDI with your suggested command:
    VBoxManage modifyhd “Windows 8.1.vdi” –resize 15000

    Then in the Windows 8.1 cloned machine in Disk Management I extended the volume with the command Extend Volume through the context menu.

    Thank you very much again!!!!

    • Gyro

      Thank you for the detailed report!

      I am happy you got it to work for you :)

    • Nadros

      Thanks for sharing this, but I’m not sure about something:

      “I solved this by starting the VirtualBox GUI as administrator on my Windows 8, and repeated the clone command.”

      What do you mean by this? Is it launching VirtualBox as Administrator? If it is, it hasn’t worked for me, I got the same error you did.

      Any help you can offer is greatly appreciated. Thanks.

  • prayags

    THanks a lot. It really helped. I was able to follow your instructions and do the needful under a minute.

  • Surya

    u da man !!

    I spent few hours already searching for “just this”, glad i wanted to try one more time and so glad i found this ..

    Real piece of cake, got it done before i finish my 1 cup of coffee ..


    VirtualBox 4.2.10, Host: Windows 8, Guest: Windows 7 Enterprise

    • Gyro

      In a couple of days this post is a year old, and it is still helping so many people!

      When you said that you were done before finishing the cup of coffee, I remembered reading somewhere that a blogger asked people for a coffee as a thank you.

      So I have added that to the website now… if you found this post helpful, buy me a coffee ;)

  • Amar

    I have not found anything about re-sizing virtual-box 4.2 machine on macbook air OS x 10.4.8

    • Gyro


      have a look at the post from Reynaldo on January 11, 2013 02:05

      He did it on Mac 10.7.5 – Virtual Box 4.2.6 r82870

      Hope that helps!

  • Mike

    Very nice!!

    I’m having some trouble with the partition resizing.

    I’m running VirtualBox 4.2.6 with a Windows XP guest on a Mac OS 10.7.4 host. I had a fixed size VDI, so I cloned it to standard format and then resized it through the command line. Then I switched (in my vbox settings) the hard disk for the vbox to the new dynamic VDI. I went to the Disk Management tools as specified, and I see the unallocated 10 GB, but there is no “Extend Volume” option anywhere I can see. What do I do?

    • Mike

      Ah, now I found the “diskpart” command line options. But it tells me that I can’t extend the current system or boot partitions. The partition I am trying to extend is both the system partition AND the boot partition. So now what?

      • Mike

        Okay, sorry for the double (triple :/ ) post. Here is what you need to do if you have my issue:

        Set the newly sized, dynamic VDI file as a SLAVE hard drive to an existing virtual machine. (If you only have one, you may need to clone the HD.) Then, fire it up. In the command prompt, type “diskpart”. Then type “list volume.” You’ll see one of them is the slave drive. (If you cloned the HD, the only distinguishing characteristic is that it DOESN’T say “system” in the list.) It will have a volume number. Type “select volume [n]”. Then type “extend.” Note that in the disk management (Right click “My Computer”->Manage->Storage->Disk Management) it will SHOW the volumes and the partitions, but won’t let you edit them.

        Then shut down the vbox, set the dynamic VDI as your main hard disk, and you’re done!

  • Detlef

    Thanks for sharing this.

  • Elisabeth

    I am having the same problem, misunderstood the dynamic size and now am stuck with 8gb which are full already needing to expand. Running virtualbox on a OSX 10.8.3 Host and an Ubuntu 12.04 Guest. Anyone who could help me out here? Am pretty new to Linux and all the stuff. Thank you!

  • Gyro


    the instructions on how to resize the VDI container are in the post.

    Once you have resized the container, boot up your Ubuntu guest, open a terminal and do this: ~$ sudo resize2fs /dev/sda1

    Good luck :)

    • Elisabeth

      thank you very much for responding soooo quickly! have followed your instructions, but it now says: filesystem is already 1048320 blocks. nothing to do! did it work then? for /dev/sda1 it still says 4,0GB.. :-(

      • Elisabeth

        trying to resize the partition now with GParted Live -> though it seems that “between” the /dev/sda1 and the unallocated space there is a /dev/sda5. therefore i can only resize /dev/sda5 being file sytsem “linux-swap” (which is inside a /dev/sda2 of format “extended”) and not the /dev/sda1 (filesystem ext4). anyone here to help on that? thanx!

        • Gyro

          I would create a new partition in the unallocated space and make that /home

          This is a bit tricky, you would have to boot the guest with a Live CD, then move everything in /home to the new partition, and then modify /etc/fstab to mount the new partition as /home

          This deserves a whole new post to be honest.

          You could also use the Gparted Live CD to first expand sda2 to take up all the space, then move sda5 to the end of sda2, then resize sda2 so the unallocated space is in front of it, and then run the terminal command in Ubuntu again to expand sda1.

          • Elisabeth

            second method i followed and it worked out fine! thanx a ton!!

          • Efren

            Hi, thank you for your post, I tried this second option as well and instead of running the terminal command, I just finished all the resizing of sda1 with GParted and it worked.

          • chris

            Thank you so much for all of this! I resized sda1 in the gparted live cd menu too. It looks like it worked. Thanks again! And after all this, never again will I underestimate my need for hard drive space :)

          • fabrice

            Hi Gyro,

            Thank you for this very instructive “how-to”, the best I found on the subject so far !

            I almost completed your method but I stalling at the very last step: extending sda1 to the new allocated space with GParted

            It’s so frustrating: I would be very happy if you could give me a hand on this !

            Config: I have a windows 7 professional host + Ubuntu 13.10 guest / VirtualBox 4.3.8

            What I did:
            -I extended the vdi from Windows command line using VBoxManage, from 5 GB to 100 GB
            -I installed GParted, I moved and extended sda2 and move sda5 to the end. Now, I have the following configuration: sda1=5Go / sda2=92Go which extends into unallocated=89.66 Go and sda5=2.98Go

            But I cannot move or expand sda1: the option is not activated when I click on sda1. There is a little key-icon next to sda1 in the table of GParted, which likely indicates that this disk is protected from modification. It was the case for sda5 when I started GParted, but I could remove it by right-clicking on it. Unfortunately, this does not work for sda1.

            You said in your post to “run the terminal command in Ubuntu again to expand sda1”
            Do you mean: running the command “sudo resize2fs /dev/sda1” in a terminal ?
            Here again, I am not lucky: I can’t run the command resize2fs, it tells me:
            sudo: resize2fs /dev/sda1: command not found
            Then, I download “system-config-lvm” to use resize2fs, but I still get the ” command not found” error message (though I rebooted the VM…)

            any idea?


          • fabrice

            Hey Gyro,

            Update on previous post, getting a step closer:
            -> now resize2fs command is working on a terminal…
            I am ashamed to say it, but I guess It’s because I didn’t put any space between “resize2fs” and “/dev/sda1).
            ->But it still doesn’t work, because it tells me (in french):
            resize2fs 1.42.8 (20-Jun-2013)
            Le système de fichiers a déjà 1316096 blocs. Rien à modifier ! = in english “filesystem is already 1316096 blocks”… So I’m back to the same step again, unable to expand sda1 to the unallocated new space created !
            Why did my operations on GParted didn’t work at all ?


          • Gyro

            The reason you could not modify sda1 is because you installed gparted and used it on the active system.

            OK, first you have to resize sda2 one more time, so it is at the end in the same size as sda5 and there is an empty space between sda1 and sda2.
            Should look something like this: [ sda1 ]_____________empty_space_____________[ sda2 [sda5] ]

            Then you need to boot the virtual box with the gParted Live CD and resize sda1 to use up the space between sda1 and sda2, you can load the iso image file of the gParted Live CD in the virtual CD drive of the virtual box (I guess you did the same to install xubuntu), or link your hardware CD drive to the virtual box and use a physical CD.

            Good Luck :)

  • Gyro

    Just a note for “smart” spammers wanting to link up their sales pitch youtube videos by crawling up my rectum with a comment: Go away! I won’t approve it anyways, no matter how much you praise this post.

  • Shivanand

    Thanks a lot! It worked.

  • anony

    idk if im typing it right C:\Program Files\Oracle\VirtualBox\VboxManage.exe modifyhd C:\Users\MyName\VirtualBox VMs\Windows XP\Windows XP.vdi–resize 30000

    • Gyro

      Since there are empty spaces in the path to the image file, you have to encapsulate the string. Try this:

      C:\Program Files\Oracle\VirtualBox\VboxManage.exe modifyhd “C:\Users\MyName\VirtualBox VMs\Windows XP\Windows XP.vdi” –resize 30000

      Also, make sure there is a space between the ” and –resize 30000 :)

  • Boss

    HI Thanks for the nice info.

    i am relatively new to Linux..pls help. I have cloned with more space but not seeing it reflected in the cloned VDI image.

    For the below command, how do I know if it is sda1 or sda2 or etc…..

    sudo resize2fs /dev/sda1

    • Gyro

      Do this in terminal:
      sudo fdisk -l

      should return something like this:
      /dev/sda1 * 2048 200886271 100442112 83 Linux

      You probably also have something like this:
      /dev/sda5 200888320 234440703 16776192 82 Linux swap / Solaris

      In which case you have to follow the steps I suggested to Elisabeth, in order to have the free space after sda1 so you can expand it.

  • virtualbox user

    Thank – Your advice saved me hours of rework.
    Virtualbox should add this into the Devices Menu.

    • Gyro

      Agree wholeheartedly, that this needs to be done in the terminal/console/command prompt level is quite lame from VirtualBox.

  • I have tried resizing a volume group of a Linux guest OS on a Windows host machine, from an original 10G to 14G. Problem is that df -h does not appear to acknowledge that the volume group has indeed been grown.

    Question: Where are my additional +900 extents (3.5G)? Why are they not showing up?

    I did the following:

    1. Cloned the .vmdk VM disk image into an .iso format with the VBoxManage “clonehd” command.

    “C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” clonehd –format VDI “C:\SPB_Data\VirtualBox VMs\Oracle Virtual Sysadmin Days\OracleLinux64-disk1.vmdk” “C:\SPB_Data\VirtualBox VMs\Oracle Virtual Sysadmin Days\OracleLinux64-disk1.vdi”

    2. Re-sized the .vdi image with the VBoxManage “modifyhd” command.

    “C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” modifyhd “C:\SPB_Data\VirtualBox VMs\Oracle Virtual Sysadmin Days\OracleLinux64-disk1.vdi” –resize 14000

    3. Use Gparted to increase the volume group vg_oraclelinux6 partition size to its full capacity.

    4. Booted into Oracle-linux6 and extended the vg_oraclelinux6 volume group with the Linux “lvextend” command.

    $ sudo lvextend -v -l +900 -r vg_oraclelinux6/lv_root

    [oracle@oraclelinux6 opt]$ df -h
    Filesystem Size Used Avail Use% Mounted on
    7.6G 4.6G 1.6G 75% /
    tmpfs 1004M 284K 1003M 1% /dev/shm
    /dev/sda1 485M 56M 405M 12% /boot
    /dev/sr0 57M 57M 0 100% /media/VBOXADDITIONS_4.2.18_88780

    [oracle@oraclelinux6 opt]$ sudo lvs
    LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
    lv_root vg_oraclelinux6 -wi-ao— 11.05g
    lv_swap vg_oraclelinux6 -wi-ao— 1.97g

    [oracle@oraclelinux6 opt]$ sudo vgs
    VG #PV #LV #SN Attr VSize VFree
    vg_oraclelinux6 2 2 0 wz–n- 13.18g 168.00m

    [oracle@oraclelinux6 opt]$ sudo pvs
    PV VG Fmt Attr PSize PFree
    /dev/sda2 vg_oraclelinux6 lvm2 a– 11.18g 168.00m
    /dev/sda3 vg_oraclelinux6 lvm2 a– 2.00g 0

    • Gyro

      Have a look at this page:

      I have never used LVM, but there seems to be a lot more steps involved, compared to increasing the size of a regular partition and file system.

      In the Summary at the bottom it says:

      “With this method we have increased the virtual disk drive through VMware, created a new partition out of this newly unallocated space within the guest OS, turned it into a physical volume, extended the volume group, and then finally extended the original logical volume over the newer physical volume resulting in overall disk space being increased successfully.”

      Since you have already increased the virtual disk and partition within, I guess the road to success would be to reduce the size of the existing partition back to what it was and then “…created a new partition out of this newly unallocated space within the guest OS, turned it into a physical volume, extended the volume group, and then finally extended the original logical volume over the newer physical volume resulting in overall disk space being increased successfully.”

      • ctacat


        I can give some details for LVM, I just increased the size of a virtual disk used in a volume group from 10 to 20 Go with success.

        I will use /dev/sdb as device file for the virtual disk in my examples, adapt the commands to yours (and be careful, don’t make any mistake, you will kill the wrong disk !). As always, backup is a good security (an it’s easy in virtual context).

        After the grow of the virtual disk, here are the steps to make the new space available :

        1. it’s needed to inform the Physical Volume it has been grown :

        # pvresize /dev/sib

        2. Now you can check the disk reports the good size :

        # pvdisplay /dev/sdb

        3. You can check also the Volume Group reports a new size :

        # vgdisplay (for example rootvg)

        4. Now you have to resize the Logical Volume to take all the free space of the Volume Group :

        # lvresize -r (for example /dev/mapper/rootvg-var)

        -r option tells lvresize to effectively resize the filesystem after logical volume resize (if the filesystem is capable of doing so while being mounted; at least ext4 can). If lvresize tells it can’t resize the filesystem, you have to unmount the logical volume, then use e2resize.

        If you want to add only a fraction of the free space of the Volume Group, you can add -L +10G to add 10 GB to the logical volume :

        # lvresize -r -L +10G /dev/mapper/rootvg-var

        In the case of Brendan, he forgot to resize the filesystem on logical volume; e2resize should help.

  • J

    FYI, on OS X I had to use –resize xxxx (note the two dashes instead of one) to get this to work.

    “Oracle VM VirtualBox Command Line Management Interface Version 4.2.4
    (C) 2005-2012 Oracle Corporation
    All rights reserved.


    VBoxManage modifyhd |
    [–type normal|writethrough|immutable|shareable|
    [–autoreset on|off]
    [–resize |–resizebyte ]”

    • Gyro


      great you got it to work :)

      OSX is almost the same as Linux in terms of terminal commands, so it makes sense that you had to use two dashes.

      I do not have a Mac, I took the command I had in the post from a comment here, I will change it now to have 2 dashes. Thanks for letting me know.

  • Thanks, sound advice! Took me 10 minutes because I am using the command line very rarely :-)
    VirtualBox should definitely include this … (and not create folders with spaces in the names)

  • 1ade

    if on osx and struggling, try this

    VBoxManage list hdds

    find the right UUID and use that instead of YOUR_HARD_DISK.vdi as detailed in blog

    • Gyro


      I can confirm that the same command works for Linux, as well as using the UUID instead of the path to the virtual drive. Will add this to my post.

      Genius tip.. thanks a lot for your comment!

  • Johnjalani

    From the Philippines :)

    Maraming maraming salamat po

    –meaning A lot of Thank you very much with respect :)

    • Gyro

      masaya ito nakatulong sa iyo!

      hopefully meaning: happy it helped you :)
      If it’s wrong, blame google translate :crazy:

  • Teravian

    I was trying to resize a Windows 7 machine in my Windows 7 host (seems redundant, I know, but I made it for a CS class I took recently. It also allows me to mess with the Windows Registry without worrying about breaking my system.) And I kept getting an error about the VirtualBox COM server not starting. Turns out, in order to resize, I had to have the Command Prompt open as an Administrator AND have the VirtualBox dashboard open as an Administrator also. Once both were open, it did it in a flash.

    I didn’t read through all the comments, so I don’t know if anyone else has run into this problem, but I thought I would share my experience, just in case no one had.

  • Mel

    This Worked Great! thank you for the support and sharing this information with the community. I also agree that they should of include this within the GUI.

  • You, my man, are a hero to me!

    Thanks for this, it saved me a lot of time.

  • Giuseppe

    COOL! Really useful and straightforward, thanks man.

  • i love you :)


  • Andrew

    i’m on a Mac OSX 10.9, and it’s not working.. i tried Reynaldo’s way up above.. i’m using Windows 7 Enterprise.. my .vdi is located in another folder.. this is exactly where it is, any suggestions?

    /Users/Andrew/VirtualBox VMs/Windows/modifyhd Windows.vdi –resize 100000

  • Andrew

    update, i used VirtualBox VMs/Windows/modifyhd Windows.vdi –resize 100000 which now is loading the program, but still not changing the size.. but at least the path is correct now.. i also used the VBoxmanage.exe in front of modifyhd and it did the same thing.. didn’t change anything.. please help!

  • Nice, this made it quite easy for me to resize a vdi I created too small for my Ubuntu VM on my MacBook Pro. Thanks! All I had to do was find out where the vdi is stored, and it’s in /Users/{myusername}/Virtualbox VMs/Ubuntu/Ubuntu.vdi.

    Thanks again!

    • Gyro

      Great it worked for you :)

      Instead of the path to the vdi file, you can also provide the Unique ID. Have a look at the 2nd orange bordered box in the post. :crazy:

  • So, it doesn’t appear to fully support all the formats that VirtualBox supports for disk images, which is sad. I got the following:

    scott@tincek:~/VirtualBox VMs/OpenVAS-6 DEMO 2.0$ VBoxManage list hdds
    UUID: d13c519e-3bb2-43b1-8424-71e06e2894d2
    Parent UUID: base
    Format: VMDK
    Location: /home/scott/VirtualBox VMs/OpenVAS-6 DEMO 1.0 rc2/OpenVAS-6-DEMO-1.0-disk1.vmdk
    State: created
    Type: normal
    Usage: OpenVAS-6 DEMO 1.0 rc2 (UUID: 2d3bac00-4b57-4aef-a494-29a4ea770dbc)

    UUID: 1f902505-3fa5-4f76-aca0-3cfb952e32f0
    Parent UUID: base
    Format: VMDK
    Location: /home/scott/VirtualBox VMs/OpenVAS-6 DEMO 1.0 rc2/SWAP1.vmdk
    State: created
    Type: normal
    Usage: OpenVAS-6 DEMO 1.0 rc2 (UUID: 2d3bac00-4b57-4aef-a494-29a4ea770dbc)

    UUID: 23550baf-2caf-4540-acf2-b3131dec7316
    Parent UUID: base
    Format: VMDK
    Location: /home/scott/VirtualBox VMs/OpenVAS-6 DEMO 1.0 rc2/UsrLocalVar.vmdk
    State: created
    Type: normal
    Usage: OpenVAS-6 DEMO 1.0 rc2 (UUID: 2d3bac00-4b57-4aef-a494-29a4ea770dbc)

    UUID: 34f82ffe-32cc-45ed-b690-2d41c01d6ae9
    Parent UUID: base
    Format: VMDK
    Location: /home/scott/VirtualBox VMs/OpenVAS-6 DEMO 2.0/OpenVAS-6-DEMO-2.0-disk1.vmdk
    State: created
    Type: normal
    Usage: OpenVAS-6 DEMO 2.0 (UUID: ed68fb68-4f6b-4ba4-be5b-5882f5474758)

    scott@tincek:~/VirtualBox VMs/OpenVAS-6 DEMO 2.0$ VBoxManage modifyhd 34f82ffe-32cc-45ed-b690-2d41c01d6ae9 –resize 20000
    Progress state: VBOX_E_NOT_SUPPORTED
    VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

    Unfortunately for me, this was provided as an appliance, so it was already in the VMDK format. I guess I have to do it the ugly “clone it over” way. Is there any advantage to going with .vdi as opposed to .vmdk?

    • Gyro

      As far as I know vdi is especially for VirtualBox, vmdk is for VMWare VMs.

      A short google search for “vdi vs vdmk” suggests that vdi runs faster than vdmk when using virtualbox, but I have never tested this.

  • James

    Worked like a charm, thank you so much!!

  • Ken

    I skimmed through the comments but didn’t find the following note that may need to be added:

    In most cases on Microsoft Windows, 1 GB does not equal 1000 MB – but instead 1024 MB (uses the Binary number system, also known as Gigabyte-base 2 definition). May need a calculator / search online to calculate the amount needed in GiB.

    For your information.

    • Gyro

      And 1024 KB is 1 MB, and 1024 Bytes is 1KB, and 8 bits is a Byte :) This is the case for all Operating Systems and partition formats, not only Windows.

      I think most people wont need an exact MB/GB size in this case, but for those who do:

      Simply type in Google.com “30GB to MB” (without the quotes), and Google will calculate the exact MB for you.

      Keep in mind, that if you want to have exactly 30GB of actual disk space available, you have to calculate even more, as part of the space will be used up by the partition table or file system.

  • Nathan

    Hey, thanks for writing and maintaining this post! I have successfully resized the vdi but when I boot up the GParted live cd it doesn’t see the extra space. This is MacOS host and Linux guest. I’ve gone through the comments but not having any luck. Any thoughts would be appreciated.

    • Gyro


      I am happy it has helped so many people get this normally simple task completed. I also enjoy reading the comments and amending my original post with the tips, ideas, and solutions provided in them :)

      I guess you had a look at my post from August 22, 2013 08:30 ?

      Normally, you should see the new space at the end of the “hard disk”, behind the swap partition… if it is not there, then something went wrong. Are you using snapshots by any chance?

      • Nathan

        That was it! Sorry to have troubled you. resize2fs didn’t work so I returned to GParted to finish the job but it seems good now, woo-hoo! Thanks again.

  • Paulo

    After hours of Net searching came along with your blog…

    Simple and it worked for me,

    just saved my month ;)

    Many thanks

  • Hi All,

    If your VDI file contains a space, you can simply drag and drop the VDI file in the correct location while writing the command to resize and that seems to work best, in all my attempts, actually typing the the VDi file location / name did not work even within quotes.
    Thanks a lot for the guide.

    • Gyro

      Nice, but I’m not sure if this will work in every OS.

      You could also do:

      $ VBoxManage list hdds
      or Windows:
      C:\Program Files\Oracle\VirtualBox\VboxManage.exe list hdds
      or Mac:

      and then use the UUID for the drive you want to resize.
      (See 2nd orange box in the OP)

  • Dave H


    New to Virtualbox.. Just experimenting /familiarising myself at present.
    I have Ubuntu Host, and Linux-Lite Guest, it was a small .vdi 7.5GB after compact 5.2GB… Great… But..!!
    My guest used to boot in @ 8 seconds, now @ 20 seconds.?… any ideas.?


  • LinuxPunchingBag

    Disappointment as usual. Still cant resize my Xubuntu.
    Progress state: VBOX_E_NOT_SUPPORTED
    VBoxManage.exe: error: Resize hard disk operation for this format is not implemented yet!

    • Gyro

      As the title suggests, this only words for .vdi images.

      What you could do is create a new .vdi virtual drive, clone the partition of the current virtual drive to the new one, and then link it to your virtual box.

      After that you can resize it as described in the post.

      Good Luck. :)

      Good Luck!

  • beheroot

    omg this is SO simple! everything i read till now was telling me that resizing is impossible. Or that i should dance at midnight without bra and ask politly good spirits of virtualization to resize vdi :> TY VERY MUCH for that post and reaserch.

  • Sandro

    thanks a lot for your guide… it was very helpful… I have a Mac , I typed the command:
    /Applications/VirtualBox.app/Contents/MacOS/VBoxManage list hdds
    After I had the UUID I type the command:
    /Applications/VirtualBox.app/Contents/MacOS/VBoxManage modifyhd –resize
    It worked perfectly!
    Thanks again

  • Brett Bullard

    For all those Mac Users out there. I figured it out:

    1.) Navigate to VDI Image. Remember if a folder has spaces in the name to enclose it in quotes. Example: cd.’/Folder space’
    2.) Then enter command VBoxManager modifyhd ‘VDIName.vdi’ —resize SizeInMB
    Example VBoxManager modifiyhd ‘Windows 8.vdi’ —resize 51200
    That command would resize my partition to be 50 g
    3.)You will need to go into you windows VM and search for
    Disk Management.
    4.) Right click your current C Drive and choose extend partition. Should default to new space available. Then let that complete and you are done.

  • Thank you for making this simple and easily available. It worked like a charm!

  • Connor

    Thank you! This is exactly the information I was looking for and it worked just as you described.

  • Thanks very much for this! Simple, unconvoluted and just what I needed! :-)

  • Thanks for finally talking about > Resize VirtualBox Disk Image – manipulate VDI images with ease!
    < Liked it!

    Feel free to surf to my web page … google search engine (http://www.ask.com)

  • Just wanted to note, you have 30GB listed as 30000MB.
    Following computer standards, unless VBox has patched that, you should get 29.296875GB with 30000MB
    30720MB should give you exactly 30GB

    1GB = 1024MB
    0.5GB = 512MB
    0.25GB = 256MB

  • Graham

    On OSX Yosemite with VirtualBox v4.3 I had to use the UUID trick mentioned earlier in order for VBoxManage to find the disk image correctly. Once I got that to work, the built in Win7 partition manager extended the disk with a couple clicks, and done!

    Thanks a bunch!

  • kumar

    Thanks Buddy….That really helped.

  • Hello, i have multiple snapshots on my server and i want resire VDI to bigger size. How i can delete all snapshots and after that i will have just one VDI file to make bigger.

    I simply need to know how to marge (delete) snapshots :(

    • Gyro

      The easiest would be to clone the latest snapshot to a new vdi and then link that one to your virtual machine.

      Something like: ~$ VBoxManage clonehd fullpath/{uuid-of-last-snapshot}.vdi the-new-disk.vdi

  • CTone

    For those looking for a way to SHRINK – to REDUCE – the size of the HD of the VM in the host, with a VM HD in VDI (not to compact the HD size in the host), I found a way, in Windows, although covoluted … it takes time and needs hd space … but can be done!

    1. Within your VM, reduce disk space usage to as little as you can/wish – use a partition manager to reduce partitions to your wished size and put all at the beginning of the disk.
    2. Create a vhd from vdi (use VboxManage clonehd your.vdi intermediate.vhd –format VHD) – your VM uuid will change …
    3. Resize the intermediate.vhd with vhdresize, which will create a new vhd.
    4. create vdi from the new vhd (use Clonevdi)

    How to:
    vhdresize download:
    http://www.pc-magazin.de/download/vhd-resize-1000283.html or

  • Ric

    Hi Gyro,
    Awesome recommendations ! I was able to increase my VirtualBox hd (Host Mac) from 25 to 50 GB. However cannot get (guest) Windows (7) to understand it. I followed your commands:

    “4. In the list, right-click the partition to expand and select Extend Volume.
    5. Follow the prompts to resize the partition and click Finish. The partition item in the Disk Management pane displays its new size.”

    But here I got stuck as there was no room for expansion. I can see the 50 GB, but the max I get from the system is the original 25 GB. There is an unallocated partition on the virtual harddisk of 24 GB. I can see but no possibility to use them. Any suggestion how to unlock this situation.
    Many thx, Ric

    • Gyro

      I tried to replicate your issue, and I ran into the same issue, I think.

      When you open the “Extend Volume” dialog, and click “Next”, you probably see this at the top: “You can only extend the volume to the available space shown below because your disk cannot be converted to dynamic or the volume being extended is a boot or system volume.” If that is the case, you will need to do this the good old “dos” way, like I just did.

      1. Backup your vdi file just in case.
      2. Start the guest, open the “Command Prompt”, enter “diskpart” and press ENTER. (A new command prompt window will open, the prompt starts with “DISKPART>”)
      3. Enter “list disk” and press ENTER, then “list volume” and press enter. This will give you the disk number (most likely “0”) and volume number (most likely “2”).
      4. Enter “select volume=x” where x is the actual volume number you got in 2. above.
      5. Enter “extend disk=x” where x is the actual disk number you got in 2. above.
      6. In some cases you may also have to use the command “extend FILESYSTEM”. I didn’t have to using Windows 7 on a NTFS partition, so you probably also don’t have to.

      Good Luck :)

  • Jorge

    Great!!! You saved my life. Thanks for the article.

  • Shailesh

    Thanks Man , Saved me lot of Work and efforts really !!!

  • Allan Barsanulfo

    Caso tente realizar o procedimento e tenha erro, verifique se o CMD está sendo aberto como administrador. Eu só consegui executar o comando quando não elevei os direitos, ou seja, não executei o CMD como administrador.

    If you try to perform the procedure and has error, verify that the CMD is being opened as an administrator. I could only run the command when not raised right, ie not performed the CMD as administrator.

  • nytro

    great post dude… this really helped after hours of research

    you Rock!!!

  • Palloy

    August 2016 update
    On host Linux (Ubuntu 16.04.1), VirtualBox 5.1.2, guest Windows 10

    The syntax is now:
    VBoxManage modifymedium /full/path/to/Win-10.vdi –resize 30000

    VirtualBox then sees the file as 29.3 GB, but Win-10 still doesn’t.
    That is because the extra space you have added is to the vdi “hard disk” and not the C:\ partition.
    So go into Disk Management, where you will see the space added is unallocated.
    Then extend the C:\ partition to include the unused space.

  • VideoPortal

    Still, that tool from mpack can resize the VDI, dynamic or fixed. Though after a run, it’s likely to be a dynamic if it was fixed.

  • sneaky spammer

    Thanks for this. I was looking for something exactly like this. Has helped me a lot.

    • Gyro

      I highly doubt that, as you added a link to a software specifically designed for VDI files. If you want to have a link to your software, you can buy me a coffee or give me an affiliate link. Don’t try free-ride on my blog.

Leave a Reply

Your email address will not be published. Required fields are marked *

What is 2 + 5 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)