{"record":{"id":"0c3cf31fa00caf21","repo":"apache/hadoop","slug":"failed-to-sync-dir","errorCode":null,"errorMessage":"Failed to sync ${dir}","messagePattern":"Failed to sync (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplica.java","lineNumber":536,"sourceCode":"    //update metaFile\n    try (RandomAccessFile metaRAF = fileIoProvider.getRandomAccessFile(\n        volume, metaFile, \"rw\")) {\n      metaRAF.setLength(newmetalen);\n      metaRAF.seek(newmetalen - checksumsize);\n      metaRAF.write(b, 0, checksumsize);\n    }\n  }\n\n  /**\n   * Sync the parent directory changes to durable device.\n   * @throws IOException\n   */\n  public void fsyncDirectory() throws IOException {\n    File dir = getDir();\n    try {\n      getFileIoProvider().dirSync(getVolume(), getDir());\n    } catch (IOException e) {\n      throw new IOException(\"Failed to sync \" + dir, e);\n    }\n  }\n}\n","sourceCodeStart":518,"sourceCodeEnd":540,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplica.java#L518-L540","documentation":"Error \"Failed to sync ${dir}\" thrown in apache/hadoop.","triggerScenarios":"Calling sync/fsync on a replica directory fails, typically due to I/O errors on the underlying disk.","commonSituations":"Syncing a storage directory to disk failed, a strong signal of disk or filesystem trouble. Check dmesg and volume health immediately.","solutions":["Check disk health and filesystem errors on the volume containing the directory; fsync failures usually indicate failing hardware.","Ensure the filesystem is not full and the mount is still writable."],"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"}