{"record":{"id":"4f5cce6a7c1ace25","repo":"apache/hadoop","slug":"has-incompatible-storage-id","errorCode":null,"errorMessage":"has incompatible storage Id.","messagePattern":"has incompatible storage Id\\.","errorType":"exception","errorClass":"InconsistentFSStateException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java","lineNumber":653,"sourceCode":"    setClusterId(props, layoutVersion, sd);\n    \n    // Read NamespaceID in version before federation\n    if (!DataNodeLayoutVersion.supports(\n        LayoutVersion.Feature.FEDERATION, layoutVersion)) {\n      setNamespaceID(props, sd);\n    }\n    \n\n    // valid storage id, storage id may be empty\n    String ssid = props.getProperty(\"storageID\");\n    if (ssid == null) {\n      throw new InconsistentFSStateException(sd.getRoot(), \"file \"\n          + STORAGE_FILE_VERSION + \" is invalid.\");\n    }\n    String sid = sd.getStorageUuid();\n    if (!(sid == null || sid.equals(\"\") ||\n          ssid.equals(\"\") || sid.equals(ssid))) {\n      throw new InconsistentFSStateException(sd.getRoot(),\n          \"has incompatible storage Id.\");\n    }\n\n    if (sid == null) { // update id only if it was null\n      sd.setStorageUuid(ssid);\n    }\n\n    // Update the datanode UUID if present.\n    if (props.getProperty(\"datanodeUuid\") != null) {\n      String dnUuid = props.getProperty(\"datanodeUuid\");\n\n      if (getDatanodeUuid() == null) {\n        setDatanodeUuid(dnUuid);\n      } else if (getDatanodeUuid().compareTo(dnUuid) != 0) {\n        throw new InconsistentFSStateException(sd.getRoot(),\n            \"Root \" + sd.getRoot() + \": DatanodeUuid=\" + dnUuid +\n            \", does not match \" + getDatanodeUuid() + \" from other\" +\n            \" StorageDirectory.\");","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java#L635-L671","documentation":"After reading storageID from a pre-federation VERSION file, DataStorage compares it with the StorageDirectory's already-known UUID. If both are non-empty and differ, the directory was previously bound to a different storage identity, and InconsistentFSStateException ('has incompatible storage Id.') rejects it.","triggerScenarios":"Mixing storage: copying or moving a data directory from another datanode (or from another storage dir with a different ID) into this location; partial re-format leaving mismatched IDs between the SD and its VERSION.","commonSituations":"Disk cloning/restores onto a different DN; reassembling dirs from backups; incorrectly shuffling data dirs between mounts or nodes.","solutions":["Return the directory to its original datanode/storage identity, or","Reformat/wipe the mismatched directory so it is recreated with this DN's storage ID (data on it is lost)","Audit for accidental copies - one physical dir must only ever be used by one DN identity"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (InconsistentFSStateException e) {\n  if (String.valueOf(e.getMessage()).contains(\"incompatible storage Id\")) {\n    // dir belongs to another storage identity: remove it from data.dir or wipe it\n  } else { throw e; }\n}","preventionTips":["Never clone or copy DN storage dirs between datanodes","When reassembling hosts from backups, verify each dir's storageID matches the DN it came from","Track dir-to-node ownership in inventory so foreign dirs are caught before startup"],"tags":["hadoop","hdfs","datanode","storage","storage-id","mismatch"],"backgroundTag":"storage-id-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}