[SOLVED] Does Virtualbox automatically resize VHD files?
-
trusktr
- Posts: 22
- Joined: 20. Jun 2010, 21:32
- Primary OS: Linux other
- VBox Version: OSE other
- Guest OSses: Windows 7
[SOLVED] Does Virtualbox automatically resize VHD files?
I was just curious. I'm implanting a Windows VHD into Virtualbox, which is about 67gb, but some of that is empty space. Can I trim down the VHD to encompass only the used space, and have Virtualbox auto-resize the VHD? Is this automatic already, or do I need to set it up?
Last edited by trusktr on 31. Aug 2013, 22:42, edited 1 time in total.
-
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: Does Virtualbox automatically resize VHD files?
Does it need to remain in VHD format? If not, then clone it using CloneVDI (see sticky in "Windows Hosts"), selecting the "Compact" option. That will (a) get rid of all the unused space, (b) convert it to VDI format, which is better for VirtualBox.
-
trusktr
- Posts: 22
- Joined: 20. Jun 2010, 21:32
- Primary OS: Linux other
- VBox Version: OSE other
- Guest OSses: Windows 7
Re: Does Virtualbox automatically resize VHD files?
Ok cool. I'll try that! Thanks. Virtualbox will autmatically keep the VDI at the minimum size with no empty space? Do VDI files that contain MS Windows need to be defragmented?
-
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: Does Virtualbox automatically resize VHD files?
No, VirtualBox will not keep releasing the unused disk space: it knows nothing about guest filesystems and hence has no way to know if disk space is still used or not. It knows only that disk space was used in the past because it was written to. If you want to keep the drive compacted you'll have to run CloneVDI on it again, periodically.
On the defragmentation question: the host container format (i.e. VDI), doesn't change how the guest OS organises drive space. So yes, like all Windows drives, it will benefit from running a good defragmenter every once in a blue moon.
On the defragmentation question: the host container format (i.e. VDI), doesn't change how the guest OS organises drive space. So yes, like all Windows drives, it will benefit from running a good defragmenter every once in a blue moon.
-
trusktr
- Posts: 22
- Joined: 20. Jun 2010, 21:32
- Primary OS: Linux other
- VBox Version: OSE other
- Guest OSses: Windows 7
Re: Does Virtualbox automatically resize VHD files?
Ok, thanks! So VDIs are autmoatically resizing, just to be sure, right?
-
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: Does Virtualbox automatically resize VHD files?
All of the dynamic image types (VDI, VHD, VMDK) essentially work the same way in VirtualBox (and other VM platforms too): they get larger as data is added. They never get smaller unless you intervene manually, by running a compact tool. VDI is preferable because it's the native image format, supported by all drive functions, and it is less prone to corruption than a VHD.