Tuesday, May 22, 2012

How to recover deleted files from hdfs/ Enable trash in hdfs

If you enable thrash in hdfs, when an rmr is issued the file will be still available in trash for some period. There by you can recover accidentally deleted ones. To enable hdfs thrash
set fs.trash.interval > 1

This specifies the time interval a file deleted would be available in trash. There is a property (fs.trash.checkpoint.interval) that specifies the checkpoint interval NN checks the trash dir at every intervals and deletes all files older than specified fs.trash.interval . ie say you have your
fs.trash.interval as 60 mins and fs.trash.checkpoint.interval as 30 mins, then in every 30 mins a check is performed and deletes all files that are more than 60 mins old.

fs.trash.checkpoint.interval should be equal to or less than fs.trash.interval

The value of fs.trash.interval  is specified in minutes.

fs.trash.interval should be enabled in client node as well as Name Node. Name Node it should be present for check pointing purposes. Based the value in client node it is decided whether to remove a file completely from hdfs or thrash it on an rmr issued from client.

The trash dir by default is /user/X/.Trash


  1. Hbase being more suitable for data warehousing, and large scale data processing and analysis.

  2. * Will this configuration be avilable in hdfs-site.xml ?

    * I have executed a rmr command in hdfs wrongly and my DFS usage is gradually getting decreased because of the files that is being deleted. Is there any way to stop the execution of that command ?

  3. This comment has been removed by the author.

  4. Hadoop is really a good booming technology in coming days. And good path for the people who are looking for the Good Hikes and long career. We also provide Hadoop online training

  5. Hadoop cluster lab setup on rest for learning purpose, if anyone interested, please look at

  6. Thankful for sharing this productive information to our vision.Informatica Training in Chennai

  7. Pretty good post. I just came across your site and wanted to say that I’ve really enjoyed reading your posts. In any case I’ll be subscribing to your feed and I hope you will keep a good work!Cheer!

    sap sd and crm online training
    sap online tutorials
    sap sd tutorial
    sap sd training in ameerpet
    sap crm training tutorial

  8. Thanks for sharing this... Hadoop is having good future we implement all designing language in to that.....
    Android Training in bangalore

  9. Hadoop is really a good booming technology in coming days. And good path for the people who are looking for the Good Hikes and long career. We also provide PHP Training and Oracle DBA


  10. Appreciation for nice Updates,if u r interested lpease visit

  11. We never miss a single post on this blog about hadoop. After attending hadoop online training, this site worked as a supplement to our technical knowledge about the subject related to cloud and other related platforms like hadoop.

  12. Thanks for your feedback. This is very nice topic. We are providing online training classes

  13. Thanks for your valuable information...its very attractive and flawless..for more details hit this link..online training on hadoop

  14. This post is really nice and informative. The explanation given is really comprehensive and informative..
    SAS Training In Chennai

  15. Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information.

    Hadoop Certification in Chennai

  16. A nice blog to follow learn the basic concepts of Hadoop, this blog has answered my plenty of questions I had regarding the HDFS. I found one more resource intellipaat which can make you understand the in and out of the Hadoop concepts.

  17. Thanks for sharing this informative information. For more you may refer http://www.s4techno.com/hadoop-training-in-pune/

  18. Really a good piece of knowledge on Big Data and Hadoop. Thanks for such a good post. I would like to recommend one more resource NPN Training which helps in getting more knowledge on Hadoop. The best part of NPN Training is they provide complete Hands-on classes.

    For More Details visit

  19. What an awesome post, I just read it from start to end. Learned something new after a long time.

    SAP SD training in Chennai

  20. 100% Job Oriented R Programming Training In Chennai for more Information click tothe best cloud-computing training in chennai

  21. 100% Job Oriented R Programming Training In Chennai for more Information click to the best uml training in chennaiuml training in chennai.

  22. Thanks for the wonderful post , great articles.

    keep posting more :)

    Best QTP Training in Chennai

  23. Great post.
    It really helped me to learn something new. So thanks.

    Oracle dba training in Bangalore

  24. Awesome resources!
    Thanks for sharing such good article. This is really helpful.

    Microsoft azure training in Bangalore

  25. thank for you information online training, excellent blog your
    best online trainings

  26. This blog is having the general information. Got a creative work and this is very different one.We have to develop our creativity mind.This blog helps for this. Thank you for this blog. This is very interesting and useful.

    Seo Company in Chennai