MKFS.CRAMFS(8) System Administration MKFS.CRAMFS(8)

# [NAME](#NAME)

mkfs.cramfs - make compressed ROM file system

# [SYNOPSIS](#SYNOPSIS)

**mkfs.cramfs** \[options] *directory file*

# [DESCRIPTION](#DESCRIPTION)

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)](/man/os/util-linux/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.)

# [ARGUMENTS](#ARGUMENTS)

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.

# [OPTIONS](#OPTIONS)

**-v**

Enable verbose messaging.

**-E**

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 the specified endianness. The default is **host**.

**-i** *file*

Insert a *file* to cramfs file system.

**-n** *name*

Set name of the cramfs file system.

**-p**

Pad by 512 bytes for boot code.

**-s**

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

**-z**

Make explicit holes.

**-l**\[**=mode**]

Use an exclusive BSD lock for the device or file that is operated upon. The optional argument *mode* can be **yes** (**1**), **no** (**0**), or **nonblock**. If the *mode* argument is omitted, it defaults to **yes**. This option overrides the environment variable **$LOCK\_BLOCK\_DEVICE**. The default is to not use any lock at all, but using a lock is recommended to avoid collisions with [**systemd-udevd**(8)](/man/os/util-linux/systemd-udevd.8) or other tools.

**-h**, **--help**

Display help text and exit.

**-V**, **--version**

Display version and exit.

# [EXIT STATUS](#EXIT_STATUS)

**0**

success

**8**

operation error, such as unable to allocate memory

# [SEE ALSO](#SEE_ALSO)

[**fsck.cramfs**(8)](/man/os/util-linux/fsck.cramfs.8), [**mount**(8)](/man/os/util-linux/mount.8)

# [REPORTING BUGS](#REPORTING_BUGS)

For bug reports, use the *issue tracker* &lt;https://github.com/util-linux/util-linux/issues&gt;.

# [AVAILABILITY](#AVAILABILITY)

The **mkfs.cramfs** command is part of the util-linux package which can be downloaded from *Linux Kernel Archive* &lt;https://www.kernel.org/pub/linux/utils/util-linux/&gt;.

2026-10-19 util-linux 2.42.4

---

Document: mkfs.cramfs(8) from util-linux 2.42.4-r1 (Chainguard OS)
