7 Replies Latest reply on May 19, 2017 10:17 AM by UlyssesOfEpirus

    Why is it so hard to compact an ext3 boot drive?

    UlyssesOfEpirus Hot Shot

      Compacting under the Virtual Machine Settings does not work on a 12 GB ext3 drive with a ubuntu derivative installed.

       

      Tried to copy it to another 12 GB drive using this from a live CD boot:

       

      dd if=/dev/sda of=/dev/sdb

       

      and the new drive's vmdk was just as large.

       

      Tried Acronis Rescue CD and the same happened.

       

      Why is it so hard?  Must I install linux again to a new drive just to recover the unused space?

        • 1. Re: Why is it so hard to compact an ext3 boot drive?
          wila Guru
          vExpertUser ModeratorsCommunity Warriors

          Hi,

           

          Not so sure it is that hard,

           

          Have you tried:

          sudo vmware-toolbox-cmd disk shrink /
          

           

          As is described here:

          Shrink guest on hosted platform - VI-Toolkit

           

          --

          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
          1 person found this helpful
          • 2. Re: Why is it so hard to compact an ext3 boot drive?
            UlyssesOfEpirus Hot Shot

            Yes I have tried exactly that. And the new disk is 6,721,437,696 bytes big whereas df inside the guest reports only 5790040 Kbytes used so 746 Mb is wasted.

             

            Also tried "dd if=/dev/zero of=foo bs=1024x1024" followed by "rm foo" and now 652 Mb is wasted.

             

            Tried "sudo vmware-toolbox-cmd disk shrink /" again and now 618 Mb is wasted.

             

            Repeated the last two steps without the "rm foo" and now 18.3 Mb is wasted.

             

            Removed the foo file, did the "sudo vmware-toolbox-cmd disk shrink /" again, and 22.4 Mb is wasted.

             

            So it works eventually, but why is it so difficult?

            1 person found this helpful
            • 3. Re: Why is it so hard to compact an ext3 boot drive?
              UlyssesOfEpirus Hot Shot

              Maybe this explains it:

               

                 11389 non-contiguous files (6.6%)
                   234 non-contiguous directories (0.1%)
              • 4. Re: Why is it so hard to compact an ext3 boot drive?
                wila Guru
                Community WarriorsvExpertUser Moderators

                Maybe, but I have my doubts that it matters for reclaiming data.

                 

                I was more inclined to think about your swap partition, assuming you have one, it will not be zeroed out.

                You would also have to compare what is used in the guest in comparison to what is used at the host.

                I was under the impression it was very close to each other once zeroed out and reclaimed.

                 

                Can't say I've seen happening what you are reporting.

                But then again, I might not have paid much attention to 500Mb wasted as it does not make much of a difference on most of my systems.

                 

                Yes I know, crazy if you still remember having used 10 MB hard disks and be amazed about how big that was.

                --

                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
                • 5. Re: Why is it so hard to compact an ext3 boot drive?
                  UlyssesOfEpirus Hot Shot

                  I have the swap partition on a separate drive. How do you compare what is used in the guest in comparison to what is used at the host?

                  • 6. Re: Why is it so hard to compact an ext3 boot drive?
                    wila Guru
                    vExpertCommunity WarriorsUser Moderators

                    Hi,

                     

                    Having the swap on a separate drive certainly would help.

                    In the past I used to do that too, even would go as far as moving that vmdk to another physical spindle, to squeeze out the last bit of performance.

                    Nowadays I tend to keep it simple and mostly stick with defaults.

                     

                    For determining the usage of space on linux I normally just run "df -h" and look at the "Used" column.

                    At host level I would look at how much the vmdk file use (or with the vm shut down look at how much space is used in the folder)

                    --

                    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: Why is it so hard to compact an ext3 boot drive?
                      UlyssesOfEpirus Hot Shot

                      This is what I was doing when I wrote "the new disk is 6,721,437,696 bytes big whereas df inside the guest reports only 5790040 Kbytes used". I thought you had a way to tell which blocks are being used. In order to discover why the above results occurred (it failed to make the vmdk smaller multiple times before eventually succeeding). Understanding the why of this might result in a better way to shrink.