{"record":{"id":"664a15980c09ec2d","repo":"apache/hadoop","slug":"directory-is-not-readable-dir","errorCode":null,"errorMessage":"Directory is not readable: ${dir}","messagePattern":"Directory is not readable: (.+?)","errorType":"exception","errorClass":"DiskErrorException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/DiskChecker.java","lineNumber":161,"sourceCode":"  }\n\n  /**\n   * Checks that the current running process can read, write, and execute the\n   * given directory by using methods of the File object.\n   * \n   * @param dir File to check\n   * @throws DiskErrorException if dir is not readable, not writable, or not\n   *   executable\n   */\n  private static void checkAccessByFileMethods(File dir)\n      throws DiskErrorException {\n    if (!dir.isDirectory()) {\n      throw new DiskErrorException(\"Not a directory: \"\n          + dir.toString());\n    }\n\n    if (!FileUtil.canRead(dir)) {\n      throw new DiskErrorException(\"Directory is not readable: \"\n                                   + dir.toString());\n    }\n\n    if (!FileUtil.canWrite(dir)) {\n      throw new DiskErrorException(\"Directory is not writable: \"\n                                   + dir.toString());\n    }\n\n    if (!FileUtil.canExecute(dir)) {\n      throw new DiskErrorException(\"Directory is not executable: \"\n                                   + dir.toString());\n    }\n  }\n\n  /**\n   * The semantics of mkdirsWithExistsCheck method is different from the mkdirs\n   * method provided in the Sun's java.io.File class in the following way:\n   * While creating the non-existent parent directories, this method checks for","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/DiskChecker.java#L143-L179","documentation":"checkAccessByFileMethods rejects a storage directory whose FileUtil.canRead(dir) returns false, throwing DiskErrorException('Directory is not readable: <dir>'). The read bit on the directory entry (or ACLs) denies the daemon user the ability to list its contents, so the disk is treated as bad.","triggerScenarios":"Directory owned by another user with mode 300/333 (no r); restrictive ACLs masking the daemon user; chmod operations during hardening that dropped the read bit.","commonSituations":"Dirs created by root then handed to the cluster without chown; security hardening scripts applying overly strict modes; shared volumes with group misalignment.","solutions":["Add the read bit: chmod u+r <dir> (or chmod 755) as appropriate","chown the directory to the daemon user/group so the mode applies","Verify as the daemon user: sudo -u yarn ls <dir>","Check ACLs/getfacl for deny entries masking permissions"],"exampleFix":"# before\nsudo chmod 300 /data/nm-local   # no read bit\n# after\nsudo chmod 755 /data/nm-local && sudo -u yarn ls /data/nm-local","handlingStrategy":"validation","validationCode":"import java.nio.file.*;\nfor (String dir : configuredDirs) {\n  Path p = Paths.get(dir);\n  if (!Files.isReadable(p)) {\n    throw new IllegalStateException(\"directory not readable by \" + System.getProperty(\"user.name\") + \": \" + dir);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Apply mode 755 (or per-security-policy) to all daemon storage dirs","Run permission checks as the daemon account, not root, in health scripts","Audit ACLs (getfacl) after hardening changes"],"tags":["disk","permissions","filesystem","diskchecker","readable"],"backgroundTag":"permission-denied","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}