"Linux learning is not difficult" file system management (3): create a file system in the Linux system

18.3 "Linux learning is not difficult" file system management ( 3 ): create a file system in the Linux system

Various file systems can be created on a partition using the mkfs command. The mkfs command itself does not perform the work of establishing a file system, but calls the relevant program to execute it. The file system here is to be specified, such as xfs , ext4 , ext3 , vfat or msdos .

Command syntax:

mkfs [ options ] [ device ]

The meaning of each option in the command is shown in the table.

Options

Meaning of options

-t < filesystem type >

Specify the file system type

-v

show details

Example: Create an xfs file system for the /dev/sda5 disk partition .

[root@rhel ~]# mkfs -t xfs /dev/sda5
meta-data=/dev/sda5              isize=256    agcount=4, agsize=6553600 blks
         =                       sectsz=512   attr=2, projid32bit=1
         = crc = 0 finobt = 0
data     =                       bsize=4096   blocks=26214400, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=12800, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

Of course, the disk partition can also be formatted into other file system types. For example, /dev/sda5 can be formatted as ext4 , ext3 , or vfat file system type.

Example: Format the /dev/sda5 partition and create an ext4 file system.

[root@rhel ~]# mkfs -t ext4 /dev/sda5

Example: Format the /dev/sda5 partition and create an ext3 file system.

[root@rhel ~]# mkfs -t ext3 /dev/sda5

Example : Format the /dev/sda5 partition and create a vfat file system.

[root@rhel ~]# mkfs -t vfat /dev/sda5

 

Note :
You can also use the commands mkfs.xfs , mkfs.ext4 , mkfs.ext3 , mkfs.ext2 , mkfs.msdos , mkfs.vfat etc. to create different file systems on disk partitions.

 

 

This article is excerpted from " Learning Linux is not difficult"Teaching material, this is a most practical Linux introductory teaching material with equal emphasis on theory and practice. To read the entire book, please visit the Linux operator ( www.linuxywz.com ) website .



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324827595&siteId=291194637