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

Undeletable HDFS Files

Solved Go to solution
Highlighted

Undeletable HDFS Files

Contributor

Hi guys,

 

How can I make a file undeletable in Hdfs. Any suggestions ?

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Undeletable HDFS Files

Master Guru
There is no immutability attribute feature in HDFS as there is on certain
Linux filesystems. Your best bet is proper access and authentication
control.

View solution in original post

7 REPLIES 7

Re: Undeletable HDFS Files

Champion

Just put it under the user directory and set the permission just like you we do Linux fs . 

 

Using  hadoop fs shell command. 

hadoop fs -chown
Usage: hadoop fs -chmod 

 

In addition for backup We can configure HDFS Snapshots point in time file recovery . 

https://hadoop.apache.org/docs/r2.7.2/hadoop-project-dist/hadoop-hdfs/HdfsSnapshots.html

Highlighted

Re: Undeletable HDFS Files

Contributor
Thanks csguna for you reply. I need put files that are not deletable even with superuser. Like chattr in Linux file system.
Highlighted

Re: Undeletable HDFS Files

Champion
Highlighted

Re: Undeletable HDFS Files

Contributor

@saranvisa


Superuser(hdfs) can delete any file in hdfs. So all i need is to make an hdfs file that cannot be deleted by anyone even superuser like the way chattr command do in linux. With ACLs i cannot make a file undeletable for all users. 

 

Thanks

Highlighted

Re: Undeletable HDFS Files

Master Guru
There is no immutability attribute feature in HDFS as there is on certain
Linux filesystems. Your best bet is proper access and authentication
control.

View solution in original post

Highlighted

Re: Undeletable HDFS Files

Contributor
Thank you @Harsh J
Highlighted

Re: Undeletable HDFS Files

Cloudera Employee

Since Hadoop 2.8, it is possible to make a directory protected and so all its files cannot be deleted, using : fs.protected.directories property.

 

From documentation:

"A comma-separated list of directories which cannot be deleted even by the superuser unless they are empty. This setting can be used to guard important system directories against accidental deletion due to administrator error."

 

It does not exactly answer the question but it is a possibility.