Synopsis #
Deleting a file does not necessarily free its blocks immediately. ZFS snapshots or clones can retain them, another process can still have the file open, and dataset quotas or reservations can limit available space independently of pool capacity. Identify which condition applies before deleting snapshots or expanding storage.
The examples use dataset tank/data mounted at /srv/data. Substitute the dataset and mount point reported by the affected system.
Compare the same filesystem #
Begin with the affected path and dataset:
$ df -h /srv/data
$ du -xsh /srv/data
$ zfs list -o space tank/data
$ zpool list
du adds up reachable files; -x avoids crossing into child filesystems. df reports the mounted filesystem’s accounting. zfs list -o space separates the dataset’s own use, snapshots, child datasets, and refreservations. Pool-wide free space is shared and does not mean that every dataset can allocate all of it.
Compression, sparse files, metadata, and shared blocks also affect comparisons. A difference between these reports is a reason to inspect the accounting, not evidence of filesystem corruption.
Check retained snapshots #
Inspect the space categories and snapshot inventory:
$ zfs get -p used,usedbydataset,usedbysnapshots,usedbychildren,usedbyrefreservation tank/data
$ zfs list -r -t snapshot -o name,used,refer,creation -s creation tank/data
When a deleted file still exists in a snapshot, those blocks remain allocated. The snapshot’s USED value counts blocks exclusive to that snapshot. Adding individual snapshot USED values can therefore undercount space retained by several snapshots together. Use usedbysnapshots for the dataset’s combined snapshot use.
Before removing a snapshot, establish its retention purpose and whether a clone or incremental backup still needs it. See Snapshot and replicate a ZFS dataset . Removing the last common replication snapshot can break the next incremental transfer.
Check quotas and reservations #
$ zfs get quota,refquota,reservation,refreservation tank/data
A quota can prevent writes while the pool has free space. A reservation can reduce space available to other datasets. Do not remove either merely to make a displayed number larger; confirm the capacity policy and competing workloads first.
Look for open files that were deleted #
A process retains access to an open file after its directory entry is removed. Its blocks can remain allocated until the final reference closes. As root, list open files on the affected filesystem:
# fstat -f /srv/data
Use the process ID to inspect a candidate’s descriptors:
# procstat -f PID
Replace PID with the observed process ID. An unlinked file may have no recoverable pathname in this output; correlate its inode, size, descriptor, and process with the recent deletion. Do not terminate a process merely because it has a file open. Use the application’s documented log-reopen, reload, or shutdown procedure when the held file is the cause.
Recheck after the chosen correction #
Repeat the original df, du, and ZFS space reports after the application closes the file, an approved retention action completes, or the quota policy changes. Space reclamation can be asynchronous. Confirm that the original workload can write again before treating a lower usage number as success.