HDFS - Trash


If trash configuration is enabled, files removed by FS Shell is not immediately removed from HDFS.

Instead, HDFS moves it to a trash directory. The file can be restored quickly as long as it remains in trash.

There could be an appreciable time delay between the time a file is deleted by a user and the time of the corresponding increase in free space in HDFS.


Most recent deleted files are moved to the current trash directory (/user/<username>/.Trash/Current), and in a configurable interval, HDFS creates checkpoints (under /user/<username>/.Trash/<date>) for files in current trash directory and deletes old checkpoints when they are expired.

After the expiry of its life in trash, the NameNode deletes the file from the HDFS namespace. The deletion of a file causes the blocks associated with the file to be freed.



Each user has its own trash directory under /user/<username>/.Trash

Trash Checkpoint

See expunge command of FS shell about checkpointing of trash.

Documentation / Reference

Powered by ComboStrap