How would I shrink a macOS guest VDI?

Discussions about using Mac OS X guests (on Apple hardware) in VirtualBox.

How would I shrink a macOS guest VDI?

Postby IOOI » 29. Aug 2017, 20:59

Hi there,

I have a virtual macOS installation (10.12.6) which uses 36,8 GB of it's hard disk space (VDI is of type "dynamically growing" until 2TB) but the VDI now has a size of 74GB, since there was once more stuff (older Xcode betas) on the disk which I deleted.

Unfortunately deleting stuff inside a VDI does not shrink it in size. So I googled how to do this, but found only how tos for Windows or Linux guests.

How would I defragment the VDI and erase the free space (can this be done using disk utility inside the guest?)?

thanks in advance,

IOOI
IOOI
 
Posts: 48
Joined: 14. Nov 2014, 18:54
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: OPENSTEP, Mac OS X, FreeBSD, Windows

Re: How would I shrink a macOS guest VDI?

Postby socratis » 29. Aug 2017, 21:17

IOOI wrote:So I googled how to do this, but found only how tos for Windows or Linux guests.

Avoid Google, use the User Manual ;).
Ch. 8.23. VBoxManage modifymedium:
For Mac OS X guests, use the "diskutil secureErase freespace 0 /" command line from an elevated Terminal.
I had to ping the manual maintainers a couple of times to change that, because Apple kept changing the way they're doing things, but I found that this command works from 10.4 to even the 10.13b.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 12679
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: How would I shrink a macOS guest VDI?

Postby mpack » 30. Aug 2017, 09:53

IOOI wrote:Unfortunately deleting stuff inside a VDI does not shrink it in size.

Shrinking the partition (with a guest partition manager) will limit how large the VDI can grow, as it only grows when disk sectors are first used.
mpack
Site Moderator
 
Posts: 25483
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP


Return to Mac OS X Guests

Who is online

Users browsing this forum: No registered users and 2 guests