Support Questions
Find answers, ask questions, and share your expertise

HDFS 整个数据目录被删,请协助

New Contributor

HDFS服务  /user/hive/warehouse整个目录被删,请协助

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Cloudera Employee

HDFS has a trash facility, in which deleted files are not actually deleted but rather are moved to a trash folder, where they remain for a minimum period before being permanently deleted by the system. The minimum period in minutes that a file will remain in the trash is set using the fs.trash.interval configuration property in core-site.xml.

 

The above said is true only when we have trash enabled or when -skipTrash is not used during delete operation. So please check whether the directory is present under "/user/<user-name>/.Trash". If the file is present then we can simply use mv or ditscp to recover the file to its original location.

 

If you have executed the operation recently then you can check NN UI for Blocks Pending Deletion. If this shows 0 blocks/relicas, then this means the blocks are already removed, and then we might need to use other mechanisms like snapshot or copy from the remote cluster. Please refer to below article for more details.


https://community.cloudera.com/t5/Internal/How-to-Recover-Files-in-HDFS-After-Removing-or-Deleting/t...

View solution in original post

4 REPLIES 4

Community Manager

Translation in English: The entire directory of HDFS service /user/hive/warehouse has been deleted, please assist



Regards,

Vidya Sargur,
Community Manager


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:

Contributor

Hi @FEIDAI 

 

Check in hdfs trash if the deleted folder is there. (if you haven't used -skipTrash)

 

If you manage to find the folder under trash, copy it to your destination path

hdfs dfs -cp /user/hdfs/.Trash/Current/<your file> <destination>

 Otherwise, The best option is probably to find and use a data recovery tool or backup,

 

Regards,

 

 

Cloudera Employee

HDFS has a trash facility, in which deleted files are not actually deleted but rather are moved to a trash folder, where they remain for a minimum period before being permanently deleted by the system. The minimum period in minutes that a file will remain in the trash is set using the fs.trash.interval configuration property in core-site.xml.

 

The above said is true only when we have trash enabled or when -skipTrash is not used during delete operation. So please check whether the directory is present under "/user/<user-name>/.Trash". If the file is present then we can simply use mv or ditscp to recover the file to its original location.

 

If you have executed the operation recently then you can check NN UI for Blocks Pending Deletion. If this shows 0 blocks/relicas, then this means the blocks are already removed, and then we might need to use other mechanisms like snapshot or copy from the remote cluster. Please refer to below article for more details.


https://community.cloudera.com/t5/Internal/How-to-Recover-Files-in-HDFS-After-Removing-or-Deleting/t...

View solution in original post

Community Manager

Hi @FEIDAI, has any of the replies resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. 



Regards,

Vidya Sargur,
Community Manager


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: