Hi all
I regularly do the disk cleanup/sdelete/vboxmanage thing to compact my windows guest vdi files, but I can't find any info on doing the same to Mac OS or OS X guests on a High Sierra host machine. I keep an El Cap virtual machine for running non-64 bit legacy software and would like to delete the surplus stuff and get back the disk space. Can anyone advise how to do this please?
Reclaim disk space for OS X guest
-
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: Reclaim disk space for OS X guest
The process is exactly the same, except you need to use the OS X disk utility in the guest to erase unused sectors in the filesystem.
-
socratis
- Site Moderator
- Posts: 27329
- Joined: 22. Oct 2010, 11:03
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Win(*>98), Linux*, OSX>10.5
- Location: Greece
Re: Reclaim disk space for OS X guest
Tried the manual? See ch. 8.23 VBoxManage modifymedium at the "--compact" option:tsp1965 wrote:I can't find any info on doing the same to Mac OS or OS X guests on a High Sierra host machine
For Mac OS X guests, use the "diskutil secureErase freespace 0 /" command line from an elevated Terminal.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
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.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Re: Reclaim disk space for OS X guest
Thanks for the reply - only small snag is that Apple removed the Secure Erase function in the disk utility app for El Cap on the grounds that it wasn't relevant for SSDs. My VM is on a Mac Pro, which has an SSD so presumably the VM thinks its VHDD is SSD also. So do I use command line to do this?
If so syntax seems to be:
diskutil secureErase freespace 3 "/Volumes/Macintosh HD"
Replacing the HDD name if it's not the default Macintosh HD
Does that look right?
If so syntax seems to be:
diskutil secureErase freespace 3 "/Volumes/Macintosh HD"
Replacing the HDD name if it's not the default Macintosh HD
Does that look right?
Re: Reclaim disk space for OS X guest
Sorry, that should be
diskutil secureErase freespace 0 "/Volumes/Macintosh HD"
not 3 - forgot to change is from my cut-and-paste before posting.
diskutil secureErase freespace 0 "/Volumes/Macintosh HD"
not 3 - forgot to change is from my cut-and-paste before posting.
-
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: Reclaim disk space for OS X guest
I can't see why a secure wipe isn't relevant to SSD. I can see why wear leveling would make it difficult.
If Apple has removed that feature then you need to find a third party tool. I've seen it done on Linux without a tool using file copy from null until space runs out.
Note that this is an OS X support problem: VirtualBox doesn't provide such a tool for any OS, even supported ones - which OS X is not.
If Apple has removed that feature then you need to find a third party tool. I've seen it done on Linux without a tool using file copy from null until space runs out.
Note that this is an OS X support problem: VirtualBox doesn't provide such a tool for any OS, even supported ones - which OS X is not.
-
socratis
- Site Moderator
- Posts: 27329
- Joined: 22. Oct 2010, 11:03
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Win(*>98), Linux*, OSX>10.5
- Location: Greece
Re: Reclaim disk space for OS X guest
Not true. I can still use it on all my 10.5 through 10.13 VMs. So, I'm not quite sure what exactly you're talking about. The only thing that changed in 10.11 is that Apple removed it from the "Disk Utility", not from the command line.tsp1965 wrote:Apple removed the Secure Erase function in the disk utility app for El Cap on the grounds that it wasn't relevant for SSDs
In fact, I had to re-open my original ticket #11175 for 10.11, specifically to remove the reference to the "Disk Utility" that was in the manual, and change it to the equivalent command-line option.
And when given a specific command, I expect that command to be executed as is. I never mentioned the "/Volumes/Macintosh HD". I specifically said "/", without the quotes, i.e.:
diskutil secureErase freespace 0 /
That's right, you can always run:mpack wrote:I've seen it done on Linux without a tool using file copy from null until space runs out.
dd if=/dev/zero of=/tmp/empty.tmp bs=1048576; rm /tmp/empty.tmp
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
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.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.