{"record":{"id":"2307b8108ab61ad8","repo":"apache/hadoop","slug":"failed-to-create-realpmemdir","errorCode":null,"errorMessage":"Failed to create ${realPmemDir}","messagePattern":"Failed to create (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/PmemVolumeManager.java","lineNumber":332,"sourceCode":"  public void recoverBlockKeyToVolume(ExtendedBlockId key, byte volumeIndex) {\n    blockKeyToVolume.put(key, volumeIndex);\n  }\n\n  @VisibleForTesting\n  static File verifyIfValidPmemVolume(File pmemDir)\n      throws IOException {\n    if (!pmemDir.exists()) {\n      final String message = pmemDir + \" does not exist\";\n      throw new IOException(message);\n    }\n    if (!pmemDir.isDirectory()) {\n      final String message = pmemDir + \" is not a directory\";\n      throw new IllegalArgumentException(message);\n    }\n\n    File realPmemDir = new File(getRealPmemDir(pmemDir.getPath()));\n    if (!realPmemDir.exists() && !realPmemDir.mkdir()) {\n      throw new IOException(\"Failed to create \" + realPmemDir.getPath());\n    }\n\n    String uuidStr = UUID.randomUUID().toString();\n    String testFilePath = realPmemDir.getPath() + \"/.verify.pmem.\" + uuidStr;\n    byte[] contents = uuidStr.getBytes(StandardCharsets.UTF_8);\n    RandomAccessFile testFile = null;\n    MappedByteBuffer out = null;\n    try {\n      testFile = new RandomAccessFile(testFilePath, \"rw\");\n      out = testFile.getChannel().map(FileChannel.MapMode.READ_WRITE, 0,\n          contents.length);\n      if (out == null) {\n        throw new IOException(\n            \"Failed to map the test file under \" + realPmemDir);\n      }\n      out.put(contents);\n      // Forces to write data to storage device containing the mapped file\n      out.force();","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/PmemVolumeManager.java#L314-L350","documentation":"Error \"Failed to create ${realPmemDir}\" thrown in apache/hadoop.","triggerScenarios":"Pmem cache initialization when the real pmem directory cannot be created, usually a permissions or mount problem.","commonSituations":"See trigger scenarios.","solutions":["Check permissions and free space on the pmem device so the DataNode can create the working directory.","Verify the pmem device is mounted read-write and healthy."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}