mkfs

build a Linux file system

mkfs [ -Vcv ] [ -t fstype ] [ fs-options ] filesys [ blocks ]

Make a Linux file system on a device, usually a hard disk partition.
filesys is the device name (e.g. /dev/hda1, /dev/sdb2).
blocks is the number of blocks to be used for the file system. A front-end for the various file system builders (mkfs.fstype)

The file system-specific builder is in /sbin, /sbin/fs, /sbin/fs.d, /etc/fs, /etc

-t fstype of file system to be built.
fs-options passed to the file system builder.
-c Check the device for bad blocks before building the file system.
-l filename Read the bad blocks list from filename
-v verbose .
-V verbose , including all file system-specific commands that are executed.
-V -V inhibits execution of any file system-specific commands, for testing.

Raspberry pi

starts with:/sbin/ mk.fat mk.cramfs mke2fs(sic) mkfs.minix

mkfs.fat mkfs.fat [options] device [block-count]

Creates an MS-DOS filesystem on device special file (e.g. /dev/sdXX). Usually a partition
-a disables alignment of data structures to cluster size, to make sure that as long as the partition is properly aligned, so will all the data structures in the filesystem.
May provide a some clusters of storage at the expense of a significant performance degradation on RAIDs, flash media or large-sector hard disks.
-b sector-of-backup location of the backup boot sector for FAT32. must be within the range of reserved sectors.
Default usually is sector 6.
-c Check for bad blocks
-C Create the file given as DEVICE line, and write the to-be-created filesystem to it. Creates the new filesystem in a file instead of on a real device, and to avoid using dd in advance to create a file of appropriate size.
BLOCK-COUNT must be given,
The file created is a sparse file, which contains only the meta-data areas (boot sector, FATs, and root directory). The resulting file can be copied later to a floppy disk or other device, or mounted through a loop device.
-D drive-number BIOS drive number to be stored in the FAT boot sector. usually 0x80 for hard disks and 0x00 for floppy devices or partitions to be used for floppy emulation.
-f number-of-fats number of file allocation tables in the filesystem. The default is 2.
-F fat-size type of file allocation tables used (12, 16 or 32 bit).
-h number-of-hidden-sectors Some digital cameras require hidden sectors
-i volume-id 32-Bit hexadecimal number (for example, 2e24ec82). The default is a based on the time.
-l FILENAME Read the bad blocks list from FILENAME.
-m message-file displayed on attempts to boot this filesystem without having installed an operating system. Maximun 418 bytes once line feeds have been converted to carriage return-line feed combinations, and tabs have been expanded. If the filename is a hyphen (-), the text is taken from standard input.
-M fat-media-type stored in the FAT boot sector. 0xF8 for hard disks and is 0xF0 or a value from 0xF9 to 0xFF for floppies or partitions to be used for floppy emulation.
-n volume-name aka label of the filesystem. up to 11 characters
-r root-dir-entries available in the root directory. default 112 or 224 for floppies and 512 for hard disks.
-R number-of-reserved-sectors FAT32 format at least 2 reserved sectors are needed, the default is 32. Otherwise the default is 1 (only the boot sector).
-s sectors-per-cluster power of 2, i.e. 1, 2, 4, 8, ... 128.
-S logical-sector-size bytes per logical sector. 512, 1024, 2048, 4096, 8192, 16384, or 32768. Values larger than 4096 are not conforming to the FAT file system
--invariant Use constants for normally randomly generated or time based data such as volume ID and creation time.
Multiple runs of mkfs.fat on the same device create identical results with this option. For testing mkfs.fat.
-v Verbose
--help
BUGS can not create boot-able filesystems. This isn't as easy as you might think at first glance for various reasons and has been discussed a lot already. mkfs.fat simply will not support it ;) SEE ALSO fatlabel(8) fsck.fat(8) The home for the dosfstools project is its GitHub project page DOS FS tools.

mkfs.cramfs compressed ROM file system

mkfs.cramfs [options] directory file

Files are compressed, the metadata is not compressed, but is expressed in a terse representation that is more space-efficient than conventional file systems.

Utility (mkcramfs) to pack files into new cramfs images.

File sizes are limited to less than 16 MB.

Maximum file system size is 272 MB. directory is 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.
-E Treat warnings as errors,
-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. defaults host.
-i file Insert a file
-n name Set name
-p Pad by 512 bytes for boot code.
-z Make explicit holes.
-v verbose
-V version information and exit.
-h help and exit.

mkfs.bfs
mke2fs
mkfs.minix
mkinitramfs low-level tool for generating an initramfs image

mkinitramfs [-c compress] [-d confdir] [-k] -o outfile [-r root] [-v] [version]
mkinitramfs [--supported-host-version= hversion]
mkinitramfs [--supported-target-version= tversion]

generates an initramfs image, a compressed cpio archive. used on a different box of the same arch with the corresponding Linux kernel.

On your local box update-initramfs calls mkinitramfs with the relevant parameters. update-initramfs keeps sha1sum of generated initramfs. It takes care to generate backups and eventually runs the bootloader. At boot time, the kernel unpacks that archive into RAM disk, mounts and uses it as initial root file system. All finding of the root device happens in this early userspace.
-c compress Override COMPRESS
-d confdir alternate configuration directory.
-k Keep the temporary directory used to make the image.
-o outfile
-r root Override ROOT
-v verbose
version kernel version of the initramfs image (defaults to the running kernel).
--supported-host-version=hversion queries if mkinitramfs can create ramdisks on a running kernel of version hversion.
--supported-target-version=tversion queries if mkinitramfs can create ramdisks for kernel version tversion.

ENVIRONMENT

$TMPDIR Default /var/tmp

FILES

/etc/initramfs-tools/initramfs.conf default configuration . See initramfs.conf(5)
/etc/initramfs-tools/modules Specified modules will be put in the generated image and loaded when the system boots. one per line as is /etc/modules, See modules(5).
/etc/initramfs-tools/conf.d allows hardcode bootargs at initramfs build time via config snippets.
set ROOT or RESUME. Useful for bootloaders, which do not pass an root bootarg.
/etc/initramfs-tools/DSDT.aml appended to the initramfs in a way that causes it to be loaded by ACPI.

EXAMPLES

Create an initramfs for current running kernel: mkinitramfs -o ~/tmp/initramfs-$(uname -r)

Create an initramfs for specific kernel and keep builddirs: mkinitramfs -k -o ~/tmp/initramfs-2.6.21-686 2.6.21-686

Debug initramfs creation (check out written logfile) : sh -x mkinitramfs -o ~/tmp/initramfs-$(uname -r) 2> ~/tmp/log

BUGS

generic options must precede and not be combined with file system-specific options.
Some file system programs do not support the -v (verbose) option, nor return meaningful exit codes.
some file system-specific programs do not automatically detect the device size and require the blocks parameter to be specified.

SEE

fs(5), badblocks(8), fsck(8), mkdosfs(8), mke2fs(8), mkfs.bfs(8), mkfs.ext2(8), mkfs.ext3(8), mkfs.minix(8), mkfs.msdos(8), mkfs.vfat(8), mkfs.xfs(8), mkfs.xiafs(8)