Mkfs
   HOME

TheInfoList



OR:

In computer operating systems, mkfs is a
command Command may refer to: Computing * Command (computing), a statement in a computer language * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on Apple Macintosh computer keyboards * ...
used to
format Format may refer to: Printing and visual media * Text formatting, the typesetting of text elements * Paper formats, or paper size standards * Newspaper format, the size of the paper page Computing * File format, particular way that informatio ...
a block storage device with a specific
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
. The command is part of
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
and
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s. In Unix, a block storage device must be formatted with a file system before it can be
mounted Mount is often used as part of the name of specific mountains, e.g. Mount Everest. Mount or Mounts may also refer to: Places * Mount, Cornwall, a village in Warleggan parish, England * Mount, Perranzabuloe, a hamlet in Perranzabuloe parish, C ...
and accessed through the operating system's filesystem hierarchy.


History

The command was originally implemented in the first version of Unix as a method to initialize either a
DECtape DECtape, originally called Microtape, is a magnetic tape data storage medium used with many Digital Equipment Corporation computers, including the PDP-6, PDP-8, LINC-8, PDP-9, PDP-10, PDP-11, PDP-12, and the PDP-15. On DEC's 32-bit systems, VA ...
(using the "t" argument) or an
RK03 Digital Equipment Corporation's RK05 is a disk drive whose removable disk pack can hold about 2.5 megabytes of data. Introduced 1972, it is similar to IBM's 1964-introduced 2310, and uses a disk pack similar to IBM's 2315 disk pack, althoug ...
disk pack (using the "r" argument). The initialization process would write formatting data to the device so that it contained an empty file system. It created the super-block, i-list, and free list on the storage device and established the root directory with entries for "." and ".." (self and parent, respectively). The RK03 disk packs had 4872 available blocks after initialization, while the tapes had 578 blocks (at 512 bytes/block). The mkfs executable was kept in the /etc directory instead of a binary directory so it would not be inadvertently called and destroy information. Later implementations of Unix-like operating systems included the mkfs command, including
HP-UX HP-UX (from "Hewlett Packard Unix") is Hewlett Packard Enterprise's proprietary implementation of the Unix operating system, based on Unix System V (initially System III) and first released in 1984. Current versions support HPE Integrity Ser ...
, Minix,
SunOS SunOS is a Unix-branded operating system developed by Sun Microsystems for their workstation and server computer systems. The ''SunOS'' name is usually only used to refer to versions 1.0 to 4.1.4, which were based on BSD, while versions 5.0 and l ...
and
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
.


Syntax

The basic syntax of the command, which is common to all modern implementations, is: $ mkfs -t where 'fs type' is the type of the filesystem and 'device' is the target UNIX device to write the filesystem data to. Usually the "device" is a drive partition. Often the command is simply a wrapper for another command that performs the formatting for a specific file system. For example, $ mkfs -t ext3 /dev/sda1 would call the command mke2fs while passing along the appropriate arguments to format the device /dev/sda1 with the ext3 filesystem. The default options for the command are stored in the file mke2fs.conf, usually in the /etc directory. Depending on the implementation and the specific file system requested, the command may have many options that can be specified such as inode size, block size, volume label, and other features. (See
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
for details) The filesystem-specific commands that mkfs calls may be invoked directly by the user from the command line. In Linux, the convention has been to name the filesystem-specific commands as: mkfs.. Where is an abbreviation for the file system, e.g., mkfs.ext2, mkfs.msdos, mkfs.minix, etc. File systems supported by the command vary by implementation and include: MSDOS, SCO bfs, CPM, ext2, ext3, ext4, minix, fat (vfat), HFS, VXFS, RF disk, RK disk, DECtape, and NTFS.


See also

* dd — convert and copy a file *
e2fsprogs e2fsprogs (sometimes called the e2fs programs) is a set of utilities for maintaining the ext2, ext3 and ext4 file systems. Since those file systems are often the default for Linux distributions, it is commonly considered to be essential software. ...
— a set of utilities for maintaining the ext2, ext3 and ext4 file systems *
fdisk In computing, the fdisk command-line utility provides disk-partitioning functions, preparatory to defining file systems. fdisk features in the DOS, DR FlexOS, IBM OS/2, and Microsoft Windows operating systems, and in certain ports of FreeBS ...
— examine and write partition table *
fsck The system utility fsck (''file system consistency check'') is a tool for checking the consistency of a file system in Unix and Unix-like operating systems, such as Linux, macOS, and FreeBSD. A similar command, CHKDSK, exists in Microsoft Windows ...
— file system check *
mkisofs cdrtools (formerly known as cdrecord) is a collection of independent projects of free software/open source computer programs. The project was maintained for over two decades by Jörg Schilling, who died on October 10, 2021. Because of some ...
— make an iso file system * mount — mount a file system *
parted GNU Parted (the name being the conjunction of the two words PARTition and EDitor) is a free partition editor, used for creating and deleting partitions. This is useful for creating space for new operating systems, reorganising hard disk usage, ...
— partition manager


References


External links


mkfs manual
{{Unix commands Unix file system-related software