Does the .vdi disk image ever shrink again?

More out of curiosity than necessity: I noticed that my Local’s .vdi image keeps getting larger and larger when I add sites. Seems logical.
However, the opposite is not true: the .vdi image file never ever shrinks when I remove sites from Local.
Much less logical.
Is there a way to compact the image, or would that involve silly terminal voodoo stuff like sudo dd if=/dev/zero | pv | sudo dd of=/bigemptyfile bs=4096k?


Hey Phil,

You’re correct. The VirtualBox disk image does not shrink, unfortunately.

You can manually shrink the image though. There are a few tutorials like Just be careful and make sure you back up the sites by exporting first!

Thanks Clay!

I now have a headache from reading and trying to understand the Linux gobbledygook you linked to.
Fortunately all my sites but one are backed up to .zip from my last flirt with Laravel Valet, so I guess just deleting everything and rebuilding will be the best way forward to save some valuable space on my SSD.

My guess is that each and every Local docker instance has a full Linux server in it – maybe we could use some Volume Master magic for the stuff that’s the same in each and every instance? (only if it doesn’t make Local slower, of course)

Haha, I don’t blame you!

Fortunately, the space in the disk doesn’t build up thanks to how Docker’s image system works. It’s kind of like onion layers that build on each other.

Most of the space will be taken up by raw MySQL data, PHP binaries on custom sites, and any other customizations you make like installing things with apt-get.

We’re evaluating other virtualization technologies and we’ll definitely keep this problem in mind!

Is there a (somewhat simple) way to find out what’s in the .vdi disk image? I’m at ~22.5GB now, and I’d be shocked, shocked I say, to find this is all MySQL data for the 14 sites I currently have in Local.

Still very curious about this one, to be honest.
Not that I’d claim to understand even the first bit of it, but my gut feeling tells me using the official Docker app instead of VirtualBox might make things somewhat leaner, less CPU- and RAM-hungry.

(I’ll probably have to use a slow 12" MacBook with 8GB RAM and small SSD for a week or two soon, and am not looking forward to seeing Local “run” [ahem] on it)

We won’t use Docker for Mac/Windows directly since we want users to be able to install Local and have it run out of the box.

However, we will use the same underlying technology which is HyperKit on macOS and Hyper-V on Windows.

1 Like

Not to be too nosy about this, but somehow I feel this would make for a really nice marketing blurb for that mythical beast we sometimes seem to be seeing a glimpse of in some far-and-distant development fog: the mighty Local Pro :star_struck:

1 Like