{
    "mode": "man",
    "parameter": "mkfs.cramfs",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/mkfs.cramfs/8/json",
    "generated": "2026-06-02T21:27:40Z",
    "synopsis": "mkfs.cramfs [options] directory file",
    "sections": {
        "NAME": {
            "content": "mkfs.cramfs - make compressed ROM file system\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "mkfs.cramfs [options] directory file\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Files on cramfs file systems are zlib-compressed one page at a time to allow random read\naccess. The metadata is not compressed, but is expressed in a terse representation that is\nmore space-efficient than conventional file systems.\n\nThe file system is intentionally read-only to simplify its design; random write access for\ncompressed files is difficult to implement. cramfs ships with a utility (mkcramfs(8)) to pack\nfiles into new cramfs images.\n\nFile sizes are limited to less than 16 MB.\n\nMaximum file system size is a little under 272 MB. (The last file on the file system must\nbegin before the 256 MB block, but can extend past it.)\n",
            "subsections": []
        },
        "ARGUMENTS": {
            "content": "The directory is simply the root of the directory tree that we want to generate a compressed\nfilesystem out of.\n\nThe file will contain the cram file system, which later can be mounted.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-v",
                    "content": "Enable verbose messaging.\n",
                    "flag": "-v"
                },
                {
                    "name": "-E",
                    "content": "Treat all warnings as errors, which are reflected as command exit status.\n",
                    "flag": "-E"
                },
                {
                    "name": "-b",
                    "content": "Use defined block size, which has to be divisible by page size.\n",
                    "flag": "-b"
                },
                {
                    "name": "-e",
                    "content": "Use defined file system edition number in superblock.\n",
                    "flag": "-e"
                },
                {
                    "name": "-N",
                    "content": "Use defined endianness. Value defaults to host.\n",
                    "flag": "-N"
                },
                {
                    "name": "-i",
                    "content": "Insert a file to cramfs file system.\n",
                    "flag": "-i"
                },
                {
                    "name": "-n",
                    "content": "Set name of the cramfs file system.\n",
                    "flag": "-n"
                },
                {
                    "name": "-p",
                    "content": "Pad by 512 bytes for boot code.\n",
                    "flag": "-p"
                },
                {
                    "name": "-s",
                    "content": "This option is ignored. Originally the -s turned on directory entry sorting.\n",
                    "flag": "-s"
                },
                {
                    "name": "-z",
                    "content": "Make explicit holes.\n",
                    "flag": "-z"
                },
                {
                    "name": "-h --help",
                    "content": "Display help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-V --version",
                    "content": "Display version information and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "0\nsuccess\n\n8\noperation error, such as unable to allocate memory\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "fsck.cramfs(8), mount(8)\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "For bug reports, use the issue tracker at https://github.com/karelzak/util-linux/issues.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The mkfs.cramfs command is part of the util-linux package which can be downloaded from Linux\nKernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.\n\n\n\nutil-linux 2.37.2                            2021-06-02                               MKFS.CRAMFS(8)",
            "subsections": []
        }
    },
    "summary": "mkfs.cramfs - make compressed ROM file system",
    "flags": [
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": "Enable verbose messaging."
        },
        {
            "flag": "-E",
            "long": null,
            "arg": null,
            "description": "Treat all warnings as errors, which are reflected as command exit status."
        },
        {
            "flag": "-b",
            "long": null,
            "arg": null,
            "description": "Use defined block size, which has to be divisible by page size."
        },
        {
            "flag": "-e",
            "long": null,
            "arg": null,
            "description": "Use defined file system edition number in superblock."
        },
        {
            "flag": "-N",
            "long": null,
            "arg": null,
            "description": "Use defined endianness. Value defaults to host."
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": "Insert a file to cramfs file system."
        },
        {
            "flag": "-n",
            "long": null,
            "arg": null,
            "description": "Set name of the cramfs file system."
        },
        {
            "flag": "-p",
            "long": null,
            "arg": null,
            "description": "Pad by 512 bytes for boot code."
        },
        {
            "flag": "-s",
            "long": null,
            "arg": null,
            "description": "This option is ignored. Originally the -s turned on directory entry sorting."
        },
        {
            "flag": "-z",
            "long": null,
            "arg": null,
            "description": "Make explicit holes."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help text and exit."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Display version information and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "fsck.cramfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/fsck.cramfs/8/json"
        },
        {
            "name": "mount",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mount/8/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Create a ROM filesystem inside a partition.",
        "examples": [
            {
                "description": "Create a ROM filesystem out of a directory inside partition Y on device X",
                "command": "sudo mkfs.cramfs {{path/to/directory}} {{/dev/sdXY}}"
            },
            {
                "description": "Create a ROM filesystem with a volume-name",
                "command": "sudo mkfs.cramfs -n {{volume_name}} {{path/to/directory}} {{/dev/sdXY}}"
            }
        ]
    }
}