I have a Windows 7 64-bit virtual machine running inside VirtualBox. When I first setup the system I gave the virtual hard drive 20GB of space to work with, but I also set it to dynamically expand (or so I thought).

Unfortunately I ran out of space and the drive is not expanding/changing, and I can't find a way to alter the size of it. Is there anything I can do in this situation?

  • I think the "dynamic expansion" option is up to the maximum you give (20Gb in this case). It means that the file outside the virtual box in your host HD doesn't necessarily take up the full 20Gb unless the virtual machine needs it. At least, that's how I interpreted the option. – Ash Feb 14 '11 at 0:40
  • Hi Ash, thanks for your response. I think you are correct in your assertion regarding this issue. What do you think I should do though? Now that I am out of space I can't install anything. Also I just can't wipe the virtual machine because I have already installed software I purchased. =( – Guest Feb 14 '11 at 0:59
  • afrazier gave you an answer already and you should accept it. You can also look at my and others answers to Resizing a Virtual Machine in VirtualBox question for additional remarks. – przemoc Feb 24 '11 at 15:26

The command line tool VBoxManage will let you resize your guest's hard drive. Open up a command prompt/terminal/whatever for your host OS, and change to the folder where VirtualBox is installed ("C:\Program Files\VirtualBox" on Windows hosts). From there, run VBoxManage list hdds to see a list of available hard drives. Find the drive that you want to resize and copy either it's full path (after Location in the output) or UUID to your clipboard for the next command. Next, run VBoxManage modifyhd C:\Path\To\Drive.vdi --resize 30000. Replace C:\Path\To\Drive.vdi with either UUID or the full path to your drive image. The number after --resize is the new size in megabytes. If you want to go larger than 30 GB, feel free.

Once that's complete, you still have to let your virtual machine know that the new space is available to use. For Win7, that's easiest to do from Disk Management.

  • resizing my vm worked fine. but then my vm is linux... so now i have to find a way to extend my linux partition to take up the extra space... any RHEL/centOS partition tips (how to extend primary partition?) – Trevor Boyd Smith Sep 13 '11 at 1:29
  • @TrevorBoydSmith: I can't really help you out with that part. GPartEd may work for you if you can't do it with the tools built into the OS. It should be a fairly easy Google search away. – afrazier Sep 14 '11 at 14:30
  • unfortunately gparted doesn't support LVM partition en.wikipedia.org/wiki/GParted#Supported_features . And IMO adjusting LVM is not easy... o/w my SO question would have been solved immediately or closed: superuser.com/questions/335038/… – Trevor Boyd Smith Sep 14 '11 at 19:52

So you mentioned the OS of the VM, but you didn't mention what the host operating system. I'm going to assume your setup is like mine, and if it isn't, then the fundamentals of this process is still identical.

This how-to should do the trick.


afrazier's answer is correct. Personally, I could never fill up a 20GB Windows guest, though, because I don' store data in the VM--I use sharing to store it on a different drive altogether. For one thing, this makes it accessible without starting the VM. It seems unlikely to me you filled 20GB with just applications.

  • It's quite easy to use up 20 GB of space for applications, especially if you're using the virtual machine as a development environment. – Jared Harley Feb 23 '11 at 1:57
  • -1, unfortunately i have easily filled up my linux VM with all application space... so i have to disagree. – Trevor Boyd Smith Sep 13 '11 at 1:07
  • I never said that "no one" could fill up a 20GB VM. I said that I never could. This is true. – CarlF Sep 14 '11 at 13:53
  • This should not be downvoted -- even though it's not worded well as an answer, using sharing to store files on the host hard drive is a great way to not fill up the virtual hard drive. – Duke Jun 6 '14 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.