Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Accidentally deleted directories on HDFS

Explorer

When data is accidentally removed from HDFS, is there a way to recover it from Trash? Trash is enabled to 360.

However I don’t see the files in the user’s /.Trash.

2 REPLIES 2

Hi @Swaapnika Guntaka

When you are deleting a data from HDFS all the data will be moved to Trash. But there is a time span between which the trash will be flushed out on regular frequency. If its flushed out then there is no way to recover the data unless you DR in place which is possible only in production environment.

Hope it Helps!!

Mentor

@Swaapnika Guntaka

Hey don't panic the files is right in there, the .Trash hides some subdirectories /Current/user see below.

Replace {xxx} with the hdfs who deleted the file and after the last / you will see all the files deleted and are not yet expurged from HDFS in your case 360.

As the user or hdfs run the below

$hdfs dfs -ls /user/{xxx}/.Trash/Current/user/{xxx}/

and to restore the file

$ hdfs dfs -cp /user/{xxx}/.Trash/Current/user/{xxx}/deleted_file  /user/{xxx}/

Hope that helps

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.