Mkfs Partition

Mkfs Partition
mkfs is used to build a Linux file system on a device, usually a hard disk partition. filesystem is either the device name (e.g. /dev/hda1, /dev/sdb2) or the mount point (e.g. /, /usr, /home) for the file system. blocks is the number of blocks to be used for the file system. mkfs is a command used to format a block storage device with a specific filesystem. The command is part of UNIX and UNIX-like operating systems. In UNIX, a block storage device must be formatted with a file system before it can be mounted and accessed through the operating system’s filesystem hierarchy.


build a Linux file system

mkfs -t <fs type> <device>

mkfs -t ext4 /dev/sda1


Using Mkfs
The type defaults to the old ext2 type, but for modern Linux hard disk systems you should always specify the type explicitly as either ext3 or ext4. These newer file system types are journalling file systems.
The mkfs commands do not care about the System ID (type) of a partition given in the partition table. You can create any type of file system in any type of partition.
Creating a partition with fdisk does not automatically create any type of file system in that partition.
Creating a file system with mkfs does not automatically mount or make available that file system for use in Linux.

Produce verbose output, including all file system-specific commands that are executed. Specifying this option more than once inhibits execution of any file system-specific commands. This is really only useful for testing.
-t fstype
Specifies the type of file system to be built. If not specified, the default file system type (currently ext2) is used.
File system-specific options to be passed to the real file system builder. Although not guaranteed, the following options are supported by most file system builders.
Check the device for bad blocks before building the file system.
-l filename
Read the bad blocks list from filename
Produce verbose output.

mkfs help

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s