Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Accidentally deleted directories on HDFS

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
Highlighted

Re: Accidentally deleted directories on HDFS

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

Highlighted

Re: Accidentally deleted directories on HDFS

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

Don't have an account?
Coming from Hortonworks? Activate your account here