Emptying the HDFS Trash

Empty the HDFS Trash by Typing

hdfs dfs -expunge

This should give you output similar to this. Basically in a minute the trash will be emptied.

5/03/27 14:19:45 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 1 minutes, Emptier interval = 0 minutes.
15/03/27 14:19:46 INFO fs.TrashPolicyDefault: Created trash checkpoint: /user/hdfs/.Trash/150327141946

What is Hadoop's HDFS Trash?

Similar to the way many desktop operating systems handle file deletions without a certain key or macro, hadoop's hdfs filesystem will move "deleted" files to the trash. You can force hdfs to immediately delete the file and skip the trash bin by giving the rm command a -skipTrash flag.

hdfs dfs -rm -skipTrash /path/to/file/you/want/to/remove/permanently

However, if you do not add the -skipTrash flag, files are stored in a trash folder, which by default is:


There are some additional configurable options for the Trash, for example you can set a time interval to automatically empty.