2 Formatting a File System

WARNING:

This documentation is a draft and is not meant for production use. Branch: OL10-FSADMIN

The mkfs.fstype command is used to create a file system on a specified device or file image.

The mkfs.fstype command creates a Linux file system on a device or file image.

sudo mkfs.fstype [-L label][options] device

Many file system types are available to provide variations on the command name, including the most commonly used file systems on Oracle Linux:

The device argument is either the device name or a file image that can contain the file system.

For example:

sudo mkfs.xfs /dev/sdb1

Note:

The mkfs -t fstype command is a wrapper command for the mkfs.fstype commands and is deprecated. It defaults to use mkfs.ext2 if no file system type is specified.

You can use the -L option to specify a file system label for most file system types.

While you don't need to specify options for the mkfs.fstype commands to work for most common use cases because the default values suffice, you might use specific options when working with particular hardware or when you intend to enable specific features within the file system. Many options are available for each file system and options are specific to each file system type. For more information, see the mkfs.fstype(8) manual pages.