Why it matters
Accidental deletes are the number one reason users file HDFS support tickets. Trash is what turns most of those tickets from data recovery emergencies into three-minute -mv operations. Turning trash off (or using -skipTrash in automation) removes that safety net and dramatically raises the cost of every human error.
Trash also has a downside: deleted files still count toward space quotas until they are truly expired. Ops teams need to understand this to avoid confusion during capacity investigations.
The architecture
Trash is implemented as a directory under each user's HDFS home: /user/{name}/.Trash. Inside it, .Trash/Current holds the most recent deletions preserving their original path structure. Periodically (every fs.trash.checkpoint.interval), .Trash/Current is renamed to a dated directory like .Trash/230715120000, and a fresh empty .Trash/Current is created for the next window.
Files stay in the dated checkpoint directory for fs.trash.interval minutes. Once that interval elapses, the checkpoint is permanently deleted. The pattern gives users a rolling window of recovery: a file deleted today is easily recoverable for a day or two, older files less so.
How it works end to end
A -rm invocation on a normal file first creates a directory hierarchy under .Trash/Current mirroring the file's original path, then renames the file into that hierarchy. Because HDFS renames are metadata-only, this is nearly instantaneous even for large files. The blocks stay exactly where they were, still counting toward NameNode and DataNode capacity.
When the checkpoint interval elapses, the NameNode renames .Trash/Current to a timestamped directory and creates a new empty .Trash/Current. This is again metadata-only, so it is fast. Then it walks previously timestamped directories, finds any older than fs.trash.interval minutes, and truly deletes them, which frees the underlying blocks.
The -skipTrash flag on -rm bypasses this entire flow. The file is immediately marked for deletion, blocks are freed on next DataNode scan, and the file is unrecoverable. Automation and pipelines that do not need the safety net often use -skipTrash for immediate space reclamation.