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.

Linux_Partitions

mkfs
build a Linux file system

Syntax
mkfs -t <fs type> <device>

Ex
mkfs -t ext4 /dev/sda1

mkfs

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.

Options
-V
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.
fs-options
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.
-c
Check the device for bad blocks before building the file system.
-l filename
Read the bad blocks list from filename
-v
Produce verbose output.

mkfs help

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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