Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of mkfs Command in Linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the usage of mkfs command under Linux system". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the usage of mkfs command under Linux system".

Mkfs

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.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Mkfs [- V] [- t fstype] [fs-options] filesys [blocks]

2. List of options

Option

Description

-V

Show detailed execution process

-t

Specifies the file system type, default ext2

Fs-options

Specific options passed to the real file system builder. Although there is no guarantee, most file system builders support the following options

-l filename

Read a list of bad blocks from the specified file

-c

Bad track detection before creating a file system

-v

Show detailed execution process

3. Examples

Create an ext2 file system

[root@localhost ~] # mknod / dev/sdb4 b 1 1 / / create a device

[root@localhost ~] # mke2fs / dev/sdb4

Mke2fs 1.41.12 (17-May-2010)

File system label =

Operating system: Linux

Block size = 1024 (log=0)

Chunk size = 1024 (log=0)

Stride=0 blocks, Stripe width=0 blocks

4096 inodes, 16384 blocks

819 blocks (5.00%) reserved for the super user

First data block = 1

Maximum filesystem blocks=16777216

2 block groups

8192 blocks per group, 8192 fragments per group

2048 inodes per group

Superblock backups stored on blocks:

8193

Writing inode table: complete

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or

180 days, whichever comes first. Use tune2fs-c or-i to override.

[root@localhost ~] # mount / dev/sdb4 / media/disk / / Mount the file system

[root@localhost ~] # df-T / / View the file system already in use

Filesystem Type 1K-blocks Used Available Use% Mounted on

/ dev/mapper/VolGroup-lv_root ext4 25552764 13250844 11003900 55%

Tmpfs tmpfs 829656 829388 829388 / dev/shm

/ dev/sda1 ext4 495844 32996 437248 8% / boot

/ dev/sr0 iso9660 56618 56618 0 / media/VBox_GAs_5.2.18

/ dev/sdb1 vfat 15863 140 14904 / media/disk

/ dev/sdb4 ext2 15863 140 14904 / media/disk / / you can see that this is the ext2 type

Thank you for reading, the above is the content of "the usage of mkfs command under Linux system". After the study of this article, I believe you have a deeper understanding of the usage of mkfs command under Linux system, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report