LinuxCommandLibrary

mkfs.cramfs

Create a compressed read-only filesystem (cramfs)

TLDR

Create a ROM filesystem inside partition Y on device X

$ mkfs.cramfs [/dev/sdXY]
copy

Create a ROM filesystem with a volume-name
$ mkfs.cramfs -n [volume_name] [/dev/sdXY]
copy

SYNOPSIS

mkfs.cramfs [-e edition] [-i file] [-l label] directory imagefile

PARAMETERS

directory
    The directory to be compressed into the cramfs image.

imagefile
    The name of the output cramfs image file.

-e edition
    Sets the edition number for the filesystem. This can be useful for tracking versions.

-i file
    Specifies an input file from which to read the filesystem image data.

-l label
    Sets the filesystem label. The label can be used to identify the filesystem when mounting.

DESCRIPTION

The mkfs.cramfs utility creates a compressed read-only file system image.
Cramfs (Compressed ROM File System) is a simple read-only compressed filesystem. It's designed for resource-constrained systems, like embedded devices, where space is at a premium.
It compresses each page separately, so random access is still possible. The resulting filesystem image is often used for booting Linux systems or storing read-only data.
The typical usage involves creating a directory structure with all the necessary files and then using mkfs.cramfs to package that directory into a compressed image file.
This image can then be mounted as a read-only filesystem.

CAVEATS

Cramfs is inherently read-only. Once created, the image cannot be modified.
It's considered somewhat outdated, and newer compressed read-only filesystems like SquashFS offer better compression and features.

FILE SIZE LIMITATIONS

Cramfs has limitations on the maximum size of files that can be stored within the filesystem.
It also has limitations on the overall size of the filesystem image itself. The internal data structures of cramfs impose these size restrictions.

USE CASES

Historically, mkfs.cramfs was frequently used for creating root filesystems for embedded devices and recovery environments.
Its small size and read-only nature made it suitable for these applications.
Nowadays, SquashFS is more frequently deployed.

HISTORY

mkfs.cramfs was developed to create cramfs filesystems, which were popular in embedded Linux systems due to their small size and read-only nature.
It was primarily used for initial RAM disks and other scenarios where disk space was highly limited.
While still available, it's being superseded by more modern compressed read-only filesystems like SquashFS due to SquashFS's superior compression algorithms and support for larger file sizes.

SEE ALSO

mount(8), umount(8)

Copied to clipboard