Create a file system

You can use the mkfs utility to create a file system for any supported file system type. To create a file system, the device must exist and be formatted with the fdisk utility.

The syntax of the mkfs command is:

mkfs -t FILE_SYSTEM_TYPE DEVICE

For example, to format the third partition of the first SATA disk on the system with the ext3 file system, we can use the following command:

mkfs -t ext3 /dev/sda3

Here is the output of the command above:

mkfs format ext3

You can see the statistics that are outputted with the formatting done by the mkfs command. The number of inodes and blocks created are outputted, as are the number of blocks per group and fragments per group. An inode, which hold metadata such as ownership and timestamps for each file, will be consumed for every file and directory in the file system. So the number of inodes shown here limits the total number of files you can create in that file system.

One of the most commonly used options with the mkfs command is the -c option, which checks the specified device for corrupted blocks before creating the file system.

 

We now need to mount the file system.

Geek University 2022