Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the mkfs command of linux to establish a file system on a specific partition

Shulou Source: shulou.com Published: 2022-06-02 18:40:41 09月22日 Update

Editor to share with you the use of linux's mkfs command to set up a file system on a specific partition. I hope you will learn a lot after reading this article. Let's discuss it together.

Create ext2, ext3, ext4, ms-dos, vfat file systems on disk partitions, and ext2 is created by default. Mkfs is used to build a Linux file system, usually a hard disk partition, on a device. The file is either a device name (for example, / dev/hda1,/dev/sdb2) or a regular file that contains the file system. Success returns 0 and failure returns 1.

In fact, mkfs is just the front end of the various file system builders (mkfs.fstype) available under Linux, searching for file system-specific generators in possible directories such as / sbin, / sbin/fs, / sbin/fs.d, / etc/fs, / etc/fs, and so on (exact lists are defined at compile time, but at least / sbin and / sbin/fs are included), and finally in the directories listed in the PATH environment variable.

Syntax format: mkfs [parameters]

Common parameters:

Device prepared to check the hard disk partition, for example: / dev/sda1-V detailed display mode-t given file system type, the default value of Linux is ext2-c before making the file system, check whether the partition has bad tracks-l bad_blocks_file adds the block data with bad tracks to the size of the block given block in bad_blocks_file

Reference example

Build a msdos file system on / dev/hda5, check for bad tracks, and list the process in detail:

[root@linuxcool] # mkfs-V-t msdos-c / dev/hda5

Format the sda6 partition to ext3 format:

[root@linuxcool] # mfks-t ext3 / dev/sda6 has finished reading this article. I believe you have some understanding of using linux's mkfs command to set up a file system on a specific partition. If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!

Tags: System file format file check command parameter directory hard drive article or device precision success search creation front end variable just at the same time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Redmi MySQL Shulou Information macOS