Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Accidentally deleted directories on HDFS

avatar
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

avatar

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!!

avatar
Master 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