apache/hadoop · error · DiskErrorException

Directory is not readable

Error message

Directory is not readable: ${dir}

What it means

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.

Solutions

  1. Add the read bit: chmod u+r <dir> (or chmod 755) as appropriate
  2. chown the directory to the daemon user/group so the mode applies
  3. Verify as the daemon user: sudo -u yarn ls <dir>
  4. Check ACLs/getfacl for deny entries masking permissions

Example fix

# before
sudo chmod 300 /data/nm-local   # no read bit
# after
sudo chmod 755 /data/nm-local && sudo -u yarn ls /data/nm-local
Defensive patterns

Strategy: validation

Validate before calling

import java.nio.file.*;
for (String dir : configuredDirs) {
  Path p = Paths.get(dir);
  if (!Files.isReadable(p)) {
    throw new IllegalStateException("directory not readable by " + System.getProperty("user.name") + ": " + dir);
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: Dirs created by root then handed to the cluster without chown; security hardening scripts applying overly strict modes; shared volumes with group misalignment.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/664a15980c09ec2d. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/DiskChecker.java:161

  }

  /**
   * Checks that the current running process can read, write, and execute the
   * given directory by using methods of the File object.
   * 
   * @param dir File to check
   * @throws DiskErrorException if dir is not readable, not writable, or not
   *   executable
   */
  private static void checkAccessByFileMethods(File dir)
      throws DiskErrorException {
    if (!dir.isDirectory()) {
      throw new DiskErrorException("Not a directory: "
          + dir.toString());
    }

    if (!FileUtil.canRead(dir)) {
      throw new DiskErrorException("Directory is not readable: "
                                   + dir.toString());
    }

    if (!FileUtil.canWrite(dir)) {
      throw new DiskErrorException("Directory is not writable: "
                                   + dir.toString());
    }

    if (!FileUtil.canExecute(dir)) {
      throw new DiskErrorException("Directory is not executable: "
                                   + dir.toString());
    }
  }

  /**
   * The semantics of mkdirsWithExistsCheck method is different from the mkdirs
   * method provided in the Sun's java.io.File class in the following way:
   * While creating the non-existent parent directories, this method checks for

View on GitHub (pinned to 2add963021)