Why does my reported used and available disk space not equal the total reported via “df”?
-
02-06-2021 - |
Pregunta
I'm running mac Big Sur (11.2.3). I get some strange disk space readings when I query free space on the command line ...
s davea$ df -h /
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk1s5s1 234Gi 14Gi 18Gi 45% 568975 2448556385 0% /
I'm confused -- the size of the disk listed (234 GB) seems to exceed the used + available by quite a lot. I've been noticing disk space issues even though there is 18GB free reported so I'm trying to track down what the problem is.
Edit: Per request, here's the diskutil output ...
$ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: EFI NO NAME 209.7 MB disk0s1
2: Apple_APFS Container disk1 250.8 GB disk0s2
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +250.8 GB disk1
Physical Store disk0s2
1: APFS Volume Macintosh HD - Data 205.8 GB disk1s1
2: APFS Volume Preboot 426.9 MB disk1s2
3: APFS Volume Recovery 613.9 MB disk1s3
4: APFS Volume VM 6.4 GB disk1s4
5: APFS Volume Macintosh HD 15.1 GB disk1s5
6: APFS Snapshot com.apple.os.update-... 15.1 GB disk1s5s1
Solución
It's because you have a 250.8 GB (= 233.6 GiB, thanks to the inconsistent units used for memory) APFS container (/dev/disk1) with a number of volumes in it, all taking up space. 15 GB (= 14 GiB) is just how much that one volume (technically a snapshot of a volume) is taking up, but the free space is the amount left after all volumes are taken into account.
diskutil list
gives a more complete view of what's going on:
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +250.8 GB disk1
Physical Store disk0s2
1: APFS Volume Macintosh HD - Data 205.8 GB disk1s1
2: APFS Volume Preboot 426.9 MB disk1s2
3: APFS Volume Recovery 613.9 MB disk1s3
4: APFS Volume VM 6.4 GB disk1s4
5: APFS Volume Macintosh HD 15.1 GB disk1s5
6: APFS Snapshot com.apple.os.update-... 15.1 GB disk1s5s1
To see how much space is taken up by each volume, look at the SIZE column. The container has 250.8 GB of space, disk1s1 is taking up 205.8 GB of that, disk1s2 is taking 426.9 MB (= 0.4269 GB), etc
So the sum of space taken by the volumes in the disk1 container (in GB) is 205.8 + 0.4269 + 0.6139 + 6.4 + 15.1 = 228.34. Note that the 15.1 MB only counts once, because disk1s5s1 is just a snapshot of disk1s5, so they at-least-mostly are just different ways of viewing the same data and it's only stored once.
Now, 228.34 GB from 250.8 GB leaves 22.46 GB (= 20.92 GiB), which doesn't quite match up with the 18 GiB of free space reported by df
. I'm not sure why there's a difference there. It may be there's some filesystem overhead that isn't counted in the space taken up by the individual volumes. Also, I suppose it's possible the snapshot of the startup disk actually has been modified slightly, so disk1s5 and disk1s5s1 don't completely share space (which would be weird, but who knows)?
Otros consejos
It's because on Big_Sur / is a read only system volume mounted on a snapshot. The size of this volume is around 15 go. The free size is 18 go, so the volume "data" may be around 200 go. The command
diskutil list
Will give the real size of your system volumes.