Support Questions

Find answers, ask questions, and share your expertise

HDFS Trash interval


Is it possible to use different Trash interval for hdfs directories. Eg Directory "Market" for trash interval 7days and directory search for "14" days?




No. When deleting a file or folder it is access and then determines whether to send it to trash or not. I also believe there is a cleaner process that then checks it to decide when to clear items out of the trash.




By default CM provides a common setting for fs.trash.interval like 1 day, 2 days, etc


But you can achieve your needs by writting a customized shell script and schedule it 

a. to move trash data to a back-up folder every day

b. delete 7 days old data automatically



This seems to be a overhead and I was seeing if hdfs could handle this request. Thanks for all replies.

Rising Star

The HDFS trash policy is pluggable. The default (and the only one supported by Cloudera) is TrashPolicyDefault (org.apache.hadoop.fs.TrashPolicyDefault). But in theory you could write your own trash policy and configure NameNode to use your trash policy.


If you are interested to see it happen, file a feature request jira at Apache Hadoop and see if someone would pick it up.

I have opened a Jira for this request. Thanks Wei