Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Why doesn't removing (rm) files free up disk space?

Using unix-level command, I use

df -g to see how much space is in use/free on a volume

du -s -g to see how large a directory is

rm to remove files and directories


Using df -g I see 38GB is available on my volume. Using rm -rf I remove a directory with 33GB in it. Using du -s -g I see that the parent directory of that directory has shrunk 33GB.


But df -g keeps showing only 38GB free. And so does the system information. What is going on?

Mac mini, macOS High Sierra (10.13.6), Server 5.6

Posted on Sep 26, 2018 2:55 PM

Reply
Question marked as Best reply

Posted on Sep 27, 2018 1:31 PM

If there's a snapshot of the disk that includes that file, you would not regain that space until the snapshot is also deleted. The system will do this automatically, but you can check it yourself if you'd like.


In terminal, run `tmutil listlocalsnapshots /` to see all the snapshots of the disk. You can also run `tmutil deletelocalsnapshots <timestamp>` to remove one. It may not immediately remove itself from the list, however.

Similar questions

15 replies
Question marked as Best reply

Sep 27, 2018 1:31 PM in response to Gerben Wierda

If there's a snapshot of the disk that includes that file, you would not regain that space until the snapshot is also deleted. The system will do this automatically, but you can check it yourself if you'd like.


In terminal, run `tmutil listlocalsnapshots /` to see all the snapshots of the disk. You can also run `tmutil deletelocalsnapshots <timestamp>` to remove one. It may not immediately remove itself from the list, however.

Sep 27, 2018 5:44 AM in response to Luis Sequeira1

No hard links (done with ln), I am certain of that. I know of APFS and its deduplication and I am quite sure that there is no other location for these files on the same volume still in existence.


Besides, deduplication would mean that a tally of all file sizes with du (or OmniDiskSweeper) run as root could only be larger than size used. The opposite is true: ODS tells me I have 255GB in use, df tells me I have 463GB in use: 200GB is missing. See 200GB free space lost from APFS boot drive

Sep 27, 2018 3:53 AM in response to Gerben Wierda

Is it possible that the files you rm'd were hard linked somewhere else?

Applications like FCP X use hard links to avoid duplicating media in some circumstances. This means that you may "see" two copies of a file but not use any more space; but then also not getting any space when removing one of them.


Another possibility is if this drive is APFS. APFS uses copy-on-write, so again if you had copied this folder from somewhere else on the drive, the files would only actually be copied if you tried to modify them.

Sep 27, 2018 10:36 AM in response to rccharles

Well, one thing I do know: what df tells me is true in the sense that if according to df the file system is full, no more files can be created and the system crashes. Both du (Apple provided tool) and ODS tell me there is far less actually on the system. The difference between the two is not normal, nor is removing 33GB of files and not getting free space, nor is du/ODS reporting more free space than df, as APFS does deduplication.

Sep 27, 2018 3:09 PM in response to crazy person

This was it. I removed the oldest, but that did not have an effect. I removed 10-12 more, and suddenly, the space is freed.


But this is worrying. Because the local snapshots fill up the boot disk and can play a role in bringing the system down (which has happened to me). Can I stop Time Machine to create these local snapshots? Or is there a way to make sure they are not this risky?

Sep 27, 2018 11:22 PM in response to rccharles

Since Apple has dropped support for installing on/upgrading of (and soon booting of) a RAID drive, I have — before installing High Sierra — changed my setup from a dual 500GB SSD in a mirror RAID to a setup where one disk is boot and the other is a time machine of that boot (apart from that I use another backup solution to backup this externally, which I already had when I was using RAID).


Here is the diskutil output (I wonder, btw, why the boot disk is only 465GB as reported by df, where is the other 34GB? And what is VM?):

dumbledore:~ sysbh$ diskutil list
/dev/disk0 (internal, physical):
  #:                      TYPE NAME                    SIZE      IDENTIFIER
  0:      GUID_partition_scheme                        *500.1 GB  disk0
  1:                        EFI EFI                    209.7 MB  disk0s1
  2:                Apple_APFS Container disk2        499.9 GB  disk0s2

/dev/disk1 (internal, physical):
  #:                      TYPE NAME                    SIZE      IDENTIFIER
  0:      GUID_partition_scheme                        *500.1 GB  disk1
  1:                        EFI EFI                    209.7 MB  disk1s1
  2:          Apple_CoreStorage DumbledoreTimeMachine  499.8 GB  disk1s2
  3:                Apple_Boot Boot OS X              134.2 MB  disk1s3

/dev/disk2 (synthesized):
  #:                      TYPE NAME                    SIZE      IDENTIFIER
  0:      APFS Container Scheme -                      +499.9 GB  disk2
                                Physical Store disk0s2
  1:                APFS Volume DumbledoreRoot          262.8 GB  disk2s1
  2:                APFS Volume Preboot                19.6 MB    disk2s2
  3:                APFS Volume Recovery                516.1 MB  disk2s3
  4:                APFS Volume VM                      24.6 KB    disk2s4

/dev/disk3 (external, physical):
  #:                      TYPE NAME                    SIZE      IDENTIFIER
  0:      GUID_partition_scheme                        *2.0 TB    disk3
  1:                        EFI EFI                    209.7 MB  disk3s1
  2:                  Apple_HFS RNAStore1              2.0 TB    disk3s2

/dev/disk4 (internal, virtual):
  #:                      TYPE NAME                    SIZE      IDENTIFIER
  0:                  Apple_HFS DumbledoreTimeMachine  +499.4 GB  disk4
                                Logical Volume on disk1s2
                                48EFF1CC-91F9-493D-BE61-2284194BDC93
                                Unlocked Encrypted


The Time Machine disk contains my Time Machine backup of my boot disk. But the local snapshots are created on the actual disk that is being backed up using APFS block deduplication. These do not take up room, unless the file system changes a lot within 24 hours (I think it keeps one every hour). The problem seems to me that the local snapshots are superfluous when Time Machine is running continuously (as it does, because the target is an internal disk).

Why doesn't removing (rm) files free up disk space?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.