Preventing inadvertent deletion of directories

You can prevent inadvertent deletion of important data from your HDFS cluster by marking specific directories as protected. Marking a directory as protected prevents its recursive deletion. However, this does not protect against graceful deletion of files under the directory. You can delete the files by moving them to trash.

  1. Go to the HDFS service.
  2. Click the Configuration tab.
  3. Set the Cluster-wide Advanced Configuration Snippet (Safety Valve) for core-site.xml property as specified:
    • Name: fs.protected.directories
    • Value: Specify a comma-separated list of the directories that you want to mark as protected; for example, /user, /data, and so on.
  4. Enter a Reason for Change, and then click Save Changes to save the property changes.
  5. Restart the cluster.