{"record":{"id":"29ed7ae6555eb768","repo":"apache/cassandra","slug":"err-wrong-disk-state-29ed7a","errorCode":"ERR_WRONG_DISK_STATE","errorMessage":"Has no permission to create directory %s","messagePattern":"Has no permission to create directory (.+?)","errorType":"error_code","errorClass":"StartupException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/service/StartupChecks.java","lineNumber":860,"sourceCode":"            if (configuration.isDisabled(name()))\n                return;\n            // check all directories(data, commitlog, saved cache) for existence and permission\n            Iterable<String> dirs = Iterables.concat(Arrays.asList(DatabaseDescriptor.getAllDataFileLocations()),\n                                                     Arrays.asList(DatabaseDescriptor.getCommitLogLocation(),\n                                                                   DatabaseDescriptor.getSavedCachesLocation(),\n                                                                   DatabaseDescriptor.getHintsDirectory().absolutePath()));\n            for (String dataDir : dirs)\n            {\n                logger.debug(\"Checking directory {}\", dataDir);\n                File dir = new File(dataDir);\n\n                // check that directories exist.\n                if (!dir.exists())\n                {\n                    logger.warn(\"Directory {} doesn't exist\", dataDir);\n                    // if they don't, failing their creation, stop cassandra.\n                    if (!dir.tryCreateDirectories())\n                        throw new StartupException(StartupException.ERR_WRONG_DISK_STATE,\n                                                   \"Has no permission to create directory \"+ dataDir);\n                }\n\n                // if directories exist verify their permissions\n                if (!Directories.verifyFullPermissions(dir, dataDir))\n                    throw new StartupException(StartupException.ERR_WRONG_DISK_STATE,\n                                               \"Insufficient permissions on directory \" + dataDir);\n            }\n        }\n    };\n\n    public static final StartupCheck checkDirectIOSupport = new StartupCheck()\n    {\n        @Override\n        public String name()\n        {\n            return \"directio_support\";\n        }","sourceCodeStart":842,"sourceCodeEnd":878,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StartupChecks.java#L842-L878","documentation":"The checkDataDirectory startup check validates each configured data directory. If a directory does not exist and cannot be created because the Cassandra process lacks filesystem permission, a StartupException(ERR_WRONG_DISK_STATE) is thrown. Cassandra refuses to start because its commit log/data directories are essential for durability and storage.","triggerScenarios":"checkDataDirectories.execute() iterates configured data_file_directories; dir.exists() is false and dir.tryCreateDirectories() returns false due to insufficient write permission on the parent, throwing the error with the offending dataDir path.","commonSituations":"cassandra.yaml points to a path under /root or /home owned by another user; directories were wiped or moved; Cassandra run as a different user than the directory owner; container volumes mounted read-only.","solutions":["Create the directory manually and give ownership to the Cassandra user: 'sudo mkdir -p <dir> && sudo chown -R cassandra:cassandra <dir>'.","Fix cassandra.yaml data_file_directories to point to a writable location for the user running Cassandra.","If running in a container, mount the volume read-write and set correct UID/GID permissions."],"exampleFix":"// before\ndata_file_directories: [/data/cassandra/data]\n# /data is root-owned, cassandra user cannot create it\n// after (shell)\n// sudo mkdir -p /data/cassandra/data && sudo chown -R cassandra:cassandra /data/cassandra","handlingStrategy":"validation","validationCode":"// pre-flight script before starting Cassandra\nfor dir in $DATA_DIRS; do\n  if [ ! -d \"$dir\" ] && ! mkdir -p \"$dir\" 2>/dev/null; then\n    echo \"Cannot create $dir as $(whoami)\"; exit 1\n  fi\n  test -w \"$dir\" || { echo \"$dir not writable\"; exit 1 }\ndone","typeGuard":null,"tryCatchPattern":"try {\n    startupChecks.execute(config);\n} catch (StartupException e) {\n    if (e.getErrorCode() == StartupException.ERR_WRONG_DISK_STATE)\n        logger.error(\"Data directory problem: {} — fix ownership/permissions as the cassandra user\", e.getMessage());\n}","preventionTips":["Provision data directories with the correct owner (cassandra:cassandra) in automation before first start.","Ensure container volumes are mounted read-write with matching UID/GID.","Keep cassandra.yaml directory paths consistent with your provisioning tooling."],"tags":["startup","filesystem","permissions"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}