{"record":{"id":"11e88371fdb8d6cc","repo":"apache/hadoop","slug":"unable-to-create-missing-aliasmap-location-level","errorCode":null,"errorMessage":"Unable to create missing aliasmap location: {levelDBpath}","messagePattern":"Unable to create missing aliasmap location: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/aliasmap/InMemoryAliasMap.java","lineNumber":111,"sourceCode":"      String blockPoolID) throws IOException {\n    Options options = new Options();\n    options.createIfMissing(true);\n    String directory =\n        conf.get(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_INMEMORY_LEVELDB_DIR);\n    if (directory == null) {\n      throw new IOException(\"InMemoryAliasMap location is null\");\n    }\n    File levelDBpath;\n    if (blockPoolID != null) {\n      levelDBpath = new File(directory, blockPoolID);\n    } else {\n      levelDBpath = new File(directory);\n    }\n    if (!levelDBpath.exists()) {\n      LOG.warn(\"InMemoryAliasMap location {} is missing. Creating it.\",\n          levelDBpath);\n      if(!levelDBpath.mkdirs()) {\n        throw new IOException(\n            \"Unable to create missing aliasmap location: \" + levelDBpath);\n      }\n    }\n    DB levelDb = JniDBFactory.factory.open(levelDBpath, options);\n    InMemoryAliasMap aliasMap =  new InMemoryAliasMap(levelDBpath.toURI(),\n        levelDb, blockPoolID);\n    aliasMap.setConf(conf);\n    return aliasMap;\n  }\n\n  @VisibleForTesting\n  InMemoryAliasMap(URI aliasMapURI, DB levelDb, String blockPoolID) {\n    this.aliasMapURI = aliasMapURI;\n    this.levelDb = levelDb;\n    this.blockPoolID = blockPoolID;\n  }\n\n  @Override","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/aliasmap/InMemoryAliasMap.java#L93-L129","documentation":"InMemoryAliasMap.init throws IOException when the resolved LevelDB path does not exist and File.mkdirs() fails to create it. After confirming dfs.provided.aliasmap.inmemory.leveldb.dir is set, Hadoop tries to create the missing directory tree (optionally with the blockPoolID appended); mkdirs() returning false means the FS refused creation — no permission on a parent, a parent that is a regular file, a read-only mount, or the path already existing as a file.","triggerScenarios":"init(conf, bpid) computes levelDBpath = <leveldb.dir>[/<bpid>], finds !exists(), and levelDBpath.mkdirs() returns false. Typical causes: parent dir not writable by the NN/DN user, path occupied by a file, NFS read-only export, or disk-full/inode-exhausted filesystem.","commonSituations":"Aliasmap directory configured under a path owned by root or another user; leftover regular file where the directory should be; containerized NameNode with an unmounted/RO volume at that path; SELinux/AppArmor denying writes.","solutions":["Verify and fix permissions/ownership of the whole parent chain: mkdir -p + chown to the Hadoop service user, ensure rwx for that user on every parent.","Check that nothing (file, symlink loop) already occupies the exact path; remove/relocate it.","Confirm the filesystem is mounted read-write and has space/inodes (mount, df -h, df -i).","Pick a directory on local persistent storage (not a read-only share) for dfs.provided.aliasmap.inmemory.leveldb.dir and restart."],"exampleFix":"# before\n# IOException: Unable to create missing aliasmap location: /data/aliasmap/BP-1234\nsudo ls -ld /data/aliasmap   # owned by root, drwxr-xr-x\n\n# after\nsudo chown -R hdfs:hadoop /data/aliasmap\nsudo chmod 755 /data/aliasmap\n# restart NameNode; LevelDB store is created on init","handlingStrategy":"validation","validationCode":"String dir = conf.get(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_INMEMORY_LEVELDB_DIR);\nFile target = bpid != null ? new File(dir, bpid) : new File(dir);\nFile parent = target.getParentFile();\nif (!target.exists() && !(parent.exists() && parent.canWrite())) {\n  throw new IOException(\"Aliasmap parent not writable: \" + parent);\n}\nInMemoryAliasMap.init(conf, bpid);","typeGuard":null,"tryCatchPattern":"try {\n  aliasMap = InMemoryAliasMap.init(conf, bpid);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Unable to create missing aliasmap\")) {\n    // fix perms on the parent chain, then retry init once\n    ensureWritable(parentChain(target));\n    aliasMap = InMemoryAliasMap.init(conf, bpid);\n  } else { throw e; }\n}","preventionTips":["Provision the aliasmap directory (mkdir -p + chown to the service user) before starting the NN/DN.","Use local writable disk, not NFS/RO mounts, for the aliasmap location.","Monitor disk space and inodes on the volume hosting the aliasmap."],"tags":["hdfs","provided-storage","aliasmap","permissions","filesystem"],"backgroundTag":"directory-create-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}