Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luckman212/apfs-free
Report real free space on APFS volume
https://github.com/luckman212/apfs-free
apfs macos swift
Last synced: 5 days ago
JSON representation
Report real free space on APFS volume
- Host: GitHub
- URL: https://github.com/luckman212/apfs-free
- Owner: luckman212
- Created: 2024-09-27T14:12:09.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-09-27T14:18:55.000Z (3 months ago)
- Last Synced: 2024-12-09T12:33:04.049Z (13 days ago)
- Topics: apfs, macos, swift
- Language: Swift
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# apfs-free
On modern macOS systems where the disks are APFS-formatted, legacy tools like `df` do not correctly report free disk space.
This is a small POC commandline tool that reports free disk space on the boot volume in JSON format, in both bytes and as a percentage.
The program uses the [`volumeAvailableCapacityForImportantUsage`][1] API.
Example (illustrates that `df` reports only 6% free, yet there is actually 22%):
```bash
$ df -h /dev/disk3s5
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk3s5 460Gi 413Gi 27Gi 94% 3.4M 281M 1% /System/Volumes/Data
``````bash
$ apfs_free
{
"availableBytes": 109467447839,
"availablePercent": 22
}
```[1]: https://developer.apple.com/documentation/foundation/urlresourcekey/checking_volume_storage_capacity