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.

Configuring specific directories as protected

To configure specific directories as protected, proceed as follows:
  1. Select 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 HDFS service.