10 Replies Latest reply on Oct 13, 2019 2:54 PM by gringley

    Shrinking APFS?

    gringley Enthusiast

      So in the good old days before APFS I could shrink Mac virtually disks with this script inside the VM:

       

      #!/bin/sh

      sudo diskutil secureErase freespace 0 Macintosh\ HD

      sudo /Library/Application\ Support/VMware\ Tools/vmware-tools-cli disk shrinkonly

      sudo halt

       

      ...but now with APFS I have to write 0 to freespace then shut the VM down and do the shrink from the host terminal.  Is vmware-tools-cli going to gain the ability to shrink APFS?

        • 1. Re: Shrinking APFS?
          gringley Enthusiast

          ....and in Catalina Beta the freespace 0 command no longer works?

          • 2. Re: Shrinking APFS?
            haralds Enthusiast

            You need to check into snapshots or disable them.

            • 3. Re: Shrinking APFS?
              dlhotka Virtuoso

              Definitely disable snapshots.

               

              But, and more importantly, I'm thinking that secureerase freespace is depreciated for APFS drives.  Even on my host machine, when erasing an external drive, file still show up in recovery software. 

              • 4. Re: Shrinking APFS?
                gringley Enthusiast

                The VM does not have any snapshots.

                • 5. Re: Shrinking APFS?
                  TECH198 Enthusiast

                  No it's not.. you can still secureerase freespace on APFS drives.. i have done it several times from the on my Mac running Mojave from Terminal:-

                   

                  Screen Shot 2019-09-25 at 6.05.21 pm.png

                   

                  (Macbook Air 256GiG SSD). I guess this is the only way since Mac OS guest "Clean up after shutting down virtual machine" only deletes snapshots for MacOS VM's.

                   

                  I guess you can always create AppleScript, then double click to run.

                  • 6. Re: Shrinking APFS?
                    wila Guru
                    Community WarriorsUser ModeratorsvExpert

                    I think they are talking about apfs snapshots..

                     

                    and it looks like that you cannot disable it anymore in 10.13 and higher.

                     

                    How to disable Local Snapshots - Apple Community

                    But you should still be able to remove local snapshots that have been made.

                     

                    re. the original question.

                    Perhaps this thread helps:

                     

                    Shrink an APFS virtual disk

                    --

                    Wil

                    | Author of Vimalin. The virtual machine Backup app for VMware Desktop Products
                    | Vimalin : Automated backups for VMware Fusion and VMware Workstation Professional
                    | More info at https://www.vimalin.com
                    | Twitter @wilva
                    | VMware Wiki at http://www.vi-toolkit.com
                    • 7. Re: Shrinking APFS?
                      gringley Enthusiast

                      I can do it in Mojave.  I am seeing I cannot do it in Catalina.

                      1 person found this helpful
                      • 8. Re: Shrinking APFS?
                        gringley Enthusiast

                        I had read that thread and have been using its correct answer to do my Mojave VMs.

                        • 9. Re: Shrinking APFS?
                          dlhotka Virtuoso

                          Yep, I've run that command many times.  Then I've run data recovery software and there's still many files available for recovery, so it's definitely not operating the same on an APFS SSD as it did on an HPFS+ SSD or metal disk.

                          1 person found this helpful
                          • 10. Re: Shrinking APFS?
                            gringley Enthusiast

                            I am seeing this is quite complicated.  In Catalina there are "Macintosh HD" and "Macintosh HD - Data" APFS volumes that are dynamically expanding and contracting in the existing free space of the disk.  The partition covers the whole disk.  If you have not been here before, Macintosh HD contains the OS, and Macintosh HD - Data contains home folders.

                             

                            Screen Shot 2019-10-13 at 5.46.30 PM.png

                             

                            Arguably shrinks could be easier if the VMware utility understood the new scheme and shrunk away the free space?  Maybe even automatic after shut down like the Windows VMs have? Otherwise how would one get into that free space to zero it if the partition already covers it?  Could the current VMware utility even see that?

                             

                            In Mojave it is still a single APFS Volume and the old ways thus work.

                            Screen Shot 2019-10-13 at 5.52.48 PM.png

                            1 person found this helpful