{"record":{"id":"f7596db3df88f05c","repo":"apache/hadoop","slug":"specified-block-size-is-less-than-configured-mi","errorCode":null,"errorMessage":"Specified block size {} is less than configured minimum value dfs.namenode.fs-limits.min-block-size={}","messagePattern":"Specified block size (.+?) is less than configured minimum value dfs\\.namenode\\.fs-limits\\.min-block-size=(.+?)","errorType":"validation","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java","lineNumber":2833,"sourceCode":"    }\n\n    INodesInPath iip = null;\n    boolean skipSync = true; // until we do something that might create edits\n    HdfsFileStatus stat = null;\n    BlocksMapUpdateInfo toRemoveBlocks = null;\n\n    checkOperation(OperationCategory.WRITE);\n    final FSPermissionChecker pc = getPermissionChecker();\n    writeLock(RwLockMode.FS);\n    try {\n      checkOperation(OperationCategory.WRITE);\n      checkNameNodeSafeMode(\"Cannot create file\" + src);\n\n      iip = FSDirWriteFileOp.resolvePathForStartFile(\n          dir, pc, src, flag, createParent);\n\n      if (blockSize < minBlockSize) {\n        throw new IOException(\"Specified block size \" + blockSize +\n            \" is less than configured minimum value \" +\n            DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY + \"=\" + minBlockSize);\n      }\n\n      if (shouldReplicate) {\n        blockManager.verifyReplication(src, replication, clientMachine);\n      } else {\n        final ErasureCodingPolicy ecPolicy = FSDirErasureCodingOp\n            .getErasureCodingPolicy(this, ecPolicyName, iip);\n        if (ecPolicy != null && (!ecPolicy.isReplicationPolicy())) {\n          checkErasureCodingSupported(\"createWithEC\");\n          if (blockSize < ecPolicy.getCellSize()) {\n            throw new IOException(\"Specified block size (\" + blockSize\n                + \") is less than the cell size (\" + ecPolicy.getCellSize()\n                +\") of the erasure coding policy (\" + ecPolicy + \").\");\n          }\n        } else {\n          blockManager.verifyReplication(src, replication, clientMachine);","sourceCodeStart":2815,"sourceCodeEnd":2851,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2815-L2851","documentation":"startFile enforces a floor on block size: dfs.namenode.fs-limits.min-block-size configured on the NameNode (default 1024 bytes; production clusters often raise it to 1MB). A create whose blockSize is below the floor is refused with IOException naming both the requested value and the configured key.","triggerScenarios":"DFSClient.create(..., blockSize) with blockSize smaller than the NameNode's dfs.namenode.fs-limits.min-block-size — e.g., an app requests 512B/64KB while the cluster enforces 1MB.","commonSituations":"Small-file test tooling carrying tiny block sizes into a hardened cluster; distro/perf guidance raised min-block-size and legacy apps kept old values; client-side hdfs-site.xml diverges from the NameNode's fs-limits.","solutions":["Raise the requested blockSize to at least the cluster's dfs.namenode.fs-limits.min-block-size (when unsure, default to 128MB or pass 0 to use the configured default)","Only if genuinely required, lower dfs.namenode.fs-limits.min-block-size on the NameNode and restart — accepting the NameNode memory cost of many tiny blocks","Mirror the NameNode's fs-limits in the client config so the check can run before the RPC"],"exampleFix":"// before\nfs.create(path, true, 4096, (short) 3, 1024L);\n// after\nlong minBlock = conf.getLong(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY,\n                             DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_DEFAULT);\nlong blockSize = Math.max(1024L, minBlock);\nfs.create(path, true, 4096, (short) 3, blockSize);","handlingStrategy":"validation","validationCode":"long minBlock = conf.getLong(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY,\n                             DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_DEFAULT);\nif (blockSize > 0 && blockSize < minBlock) blockSize = minBlock;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hardcode sub-megabyte block sizes in app code","Mirror the NameNode's dfs.namenode.fs-limits.* in client-side config"],"tags":["hdfs","block-size","fs-limits","file-create","configuration"],"backgroundTag":"block-size-below-minimum","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}