Support Questions

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

Undeletable HDFS Files

avatar
Contributor

Hi guys,

 

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

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION

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

avatar
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

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

avatar
Champion

avatar
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

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

avatar
Contributor
Thank you @Harsh J

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