Resize VDI drive

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Gutchi
Posts: 34
Joined: 4. Apr 2016, 14:50

Resize VDI drive

Post by Gutchi »

Hello,

I use VirtualBox 6.1.26 on my Linux Mint host, and i have a VM with Windows10 the drive is dynamically allocated.
I have launch a bunch of updates (the OS and some software ... ) and the drive space occupation in the VM grow up to 110G, after cleaning everything the among of data is 40G in the VM. But the size of the VDI on my Linux host is still around 120G, it have grow up a lot during the updates, around 40G more than before the upgrade .

Is it possible to resize the drive dynamically to the real data occupation to the VM and free the 40G on the host?

Thanks you
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Resize VDI drive

Post by mpack »

The process is called compaction. We don't refer to resizing since that could cause confusion: the drive logical size does not change.

Compaction can be done easily. In fact the easiest way is to clone the VDI using the CloneVDI tool. If you tick the "Keep UUID" and "Compact" checkboxes then the clone VDI will be a drop in replacement for the larger VDI, needing only to be renamed to make a complete replacement.

Be aware however that for most VMs there is a "natural" size for the VDI based on your usage patterns, so the VDI is likely to grow again. Compaction is only really worthwhile if growth was significant and the cause was a one-off error. VMs are not something you want to get into if you don't have enough disk space!
Post Reply