Your company here — click to reach over 10,000 unique daily visitors

mkfs.cramfs - Man Page

make compressed ROM file system

Examples (TL;DR)


mkfs.cramfs [options] directory file


Files on cramfs file systems are zlib-compressed one page at a time to allow random read access. The metadata is not compressed, but is expressed in a terse representation that is more space-efficient than conventional file systems.

The file system is intentionally read-only to simplify its design; random write access for compressed files is difficult to implement. cramfs ships with a utility (mkcramfs(8)) to pack files into new cramfs images.

File sizes are limited to less than 16 MB.

Maximum file system size is a little under 272 MB. (The last file on the file system must begin before the 256 MB block, but can extend past it.)


The directory is simply the root of the directory tree that we want to generate a compressed filesystem out of.

The file will contain the cram file system, which later can be mounted.



Enable verbose messaging.


Treat all warnings as errors, which are reflected as command exit status.

-b blocksize

Use defined block size, which has to be divisible by page size.

-e edition

Use defined file system edition number in superblock.

-N big, little, host

Use defined endianness. Value defaults to host.

-i file

Insert a file to cramfs file system.

-n name

Set name of the cramfs file system.


Pad by 512 bytes for boot code.


This option is ignored. Originally the -s turned on directory entry sorting.


Make explicit holes.


Use exclusive BSD lock for device or file it operates.  The optional argument mode can be yes, no (or 1 and 0) or nonblock.  If the mode argument is omitted, it defaults to "yes".  This option overwrites environment variable $LOCK_BLOCK_DEVICE.  The default is not to use any lock at all, but it’s recommended to avoid collisions with udevd or other tools.

-h,  --help

Display help text and exit.

-V,  --version

Print version and exit.

Exit Status




operation error, such as unable to allocate memory

See Also

fsck.cramfs(8), mount(8)

Reporting Bugs

For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues.


The mkfs.cramfs command is part of the util-linux package which can be downloaded from Linux Kernel Archive.

Referenced By

fsck.cramfs(8), systemd-makefs@.service(8).

2024-04-24 util-linux 2.40.2 System Administration