Configuring HDFS trash
The Hadoop trash feature helps prevent accidental deletion of files and directories.
When you delete a file in HDFS, the file is not immediately expelled from HDFS. Deleted files
are first moved to the /user/<username>/.Trash/Current
directory, with
their original filesystem path being preserved. After a user-configurable period of time
(fs.trash.interval
), a process known as trash checkpointing renames the
Current
directory to the current timestamp, that is,
/user/<username>/.Trash/<timestamp>
. The checkpointing process
also checks the rest of the .Trash
directory for any existing timestamp
directories and removes them from HDFS permanently. You can restore files and directories in
the trash simply by moving them to a location outside the .Trash
directory.