Linux partition formatted

Format (the format) refers to a disk or disk partition (Partition) carrying out an operation to initialize, which normally cause all of the files existing disk or partition is cleared. Formatting usually divided into low-level formatting and high-level format. If not specified, formatting the hard drive usually refers to high-level format. Formatted generated UUID.

A, linux partition formatting commands support

CentOS7-1810 and Ubuntu18.04 support of formatting commands

mkfs   mkfs.cramfs   mkfs.ext3    mkfs.fat   mkfs  .msdos    mkfs.xfs
mkfs.btrfs    mkfs.ext2    mkfs.ext4    mkfs.minix    mkfs.vfat

openSUSE15 support of formatting commands

mkfs    mkfs.btrfs   mkfs.ext2   mkfs.ext4   mkfs.minix   mkfs.ntfs    mkfs.xfs
mkfs.bfs    mkfs.cramfs   mkfs.ext3   mkfs.fat    mkfs.msdos   mkfs.vfat

Debian9.5 support formatting commands
mkfs mkfs.cramfs mkfs.ext2 mkfs.ext4 mkfs.minix mkfs.ntfs
mkfs.bfs mkfs.exfat mkfs.ext3 mkfs.fat mkfs.msdos mkfs.vfat

Second, commonly used command format described

. 1, the mkfs
the mkfs distal end is in Linux file system program of each program dedicated to mkfs.fs-type. mkfs itself does not establish the implementation of the file system, but to call the relevant procedures to implement. For example, if you specify ext4 in the "-t" parameter, then
mkfs calls mkfs.ext4 to create a file system. mkfs command is part of the package util-linux.

Usage:
mkfs [Options] [type] [equipment]

Options:
. -T, file system type; if not specified, will use ext2, if you want to know what support behind -t filesystem, mkfs can be entered on the command line after you press the Tab key twice, displays several command remove the front mkfs. back is supported by the file system. As is clear mkfs.ext4 support ext4 file system.

Example: ext4 file system formatted
------------------------------------------- -----------------------
[CentOS7 the root @ ~] # the mkfs -t ext4 / dev / sdb1
the mke2fs 1.42.9 (-On Dec-28, 2013)
file system label =
the OS type: the Linux
block size = 4096 (log = 2)
block size 4096 = (log = 2)
Stride blocks = 0, 0 = Stripe width blocks
65536 of inodes, 262144 blocks
13107 blocks (5.00%) The Super User Reserved for
a first data block 0 =
the Maximum filesystem = 268435456 Blocks
. 8 Block Groups
32768 Blocks per Group, 32768 Group fragments per
8192 of inodes per Group
of Superblock Backups Stored ON Blocks:
32768, 98304, 163840, 229376

Allocating group tables: completion
is writing inode table: Finish
Creating journal (8192 blocks): complete
Writing superblocks and filesystem accounting information: # successfully completed
-------------------- -----------------------------------

Example: xfs formatted file system
------------------------------------------ -------------
[root @ CentOS7 ~] # XFS mkfs -t / dev / sdb1
mkfs.xfs:. / dev / sdb1 the Appears to Contain AN existing filesystem (ext4) # prompt the partition existing ext4 file system
mkfs.xfs:. use the -f option to force overwrite # using the -f option to force coverage.
[CentOS7 the root @ ~] # XFS the mkfs -t -f / dev / sdb1
Meta-Data = / dev / sdb1 an array of lSize = 512 = agcount. 4, agsize BLKS = 65536
= sectsz attr = 512 = 2, projid32bit. 1 =
= = CRC . 1 finobt = 0, sparse = 0
Data = BSIZE = 4096 Blocks = 262144, imaxpct = 25
= SUnit = 0 SWidth = 0 BLKS
Naming = Version 2 BSIZE = 4096 ASCII-CI = 0 FTYPE =. 1
log = Internal log BSIZE = 4096 = 2560 Blocks, Version 2 =
= = 512 SUnit sectsz BLKS = 0, the lazy-COUNT. 1 =
realtime =none extsz=4096 blocks=0, rtextents=0
[root@CentOS7 ~]#
-------------------------------------------------------

2, mke2fs
mke2fs command is devoted to a series of specialized tools ext file system management. As well as its command mkfs.ext2, mkfs.ext3, mkfs.ext4 and other derivatives, and their use mke2fs similar, in that they help manual system man will jump directly help manual mke2fs command. There are many options for formatting the demand characteristics of this command. Options command so many here only introduce a few more below to see through the man mke2fs

Format:

mke2fs [options] [device]

-t type Specifies the file system (e.g., ext2, ext3, ext4, etc.), it will be read from the default configuration file /etc/mke2fs.conf;
-b block size of the disk is provided.
-L label set;
-j create ext3 file system, mkfs.ext3 comes the option;
the number of the inode -N disposed;
; -m set as a percentage of the file system reserved block
before the file system is created -c Drive Self Test process;
-U UUID using the specified file system is created, UUID to comply with his naming format, this option is very useful and can be formatted into a previously existing partition UUID partition.

Example: Creating ext4 file system and set the volume label vname:
------------------------------------- ------------------
[CentOS7 the root @ ~] -L # vname the mke2fs -t ext4 / dev / sdb1
the mke2fs 1.42.9 (-On Dec-28, 2013)
file system label vname =
the OS type: the Linux
block size = 4096 (log = 2) #block default size of
block size 4096 = (log = 2)
Stride blocks = 0, 0 = Stripe width blocks
65536 of inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
of the first data block 0 =
the Maximum filesystem blocks = 268435456
. 8 block Groups
32768 blocks per Group, 32768 Group fragments per
8192 of inodes per Group
of Superblock Backups Stored oN blocks:
32768, 98304, 163840, 229376

Allocating group tables: completed
is being written inode table: complete
Creating journal (8192 blocks): complete
Writing superblocks and filesystem accounting information: complete

-------------------------------------------------------

3, mkfs.xfs
XFS file system is an advanced journaling file system developed by SGI, XFS is very scalable and very robust. Fortunately, the SGI to be ported to Linux. RedHat7 future default file system.

Format:

mkfs.xfs [options] [device ]

Options
-b size = Set the hard disk block size, the default of 4096 bytes, equal sign followed by their size, do not add units
-m uuid = UUID to change the number of the partition, then the equal sign as the actual set uuid, UUID to meet his naming format.
-f force overwrite
option for so many commands introduced here only a few more below to see through the man mkfs.xfs

 

Examples: block size formatted partition 1024B uuid as 0dd5db1c-2f1f-45e7-bbc1-0cbd68ca2f2d overwrite the existing file system and force
----------------------- --------------------------------
[CentOS7 the root @ ~] # 1024 the mkfs.xfs -b size = -m UUID 0dd5db1c-2f1f-45E7 = bbc1-0cbd68ca2f2d--f / dev / sdb1
Meta-Data = / dev / sdb1 an array of lSize = 512 = agcount. 4, agsize BLKS = 262144
= sectsz attr = 512 = 2, projid32bit. 1 =
= =. 1 CRC finobt = 0, sparse 0 =
Data = BSIZE = 1024 Blocks = 1048576, imaxpct = 25
= SUnit = 0 SWidth = 0 BLKS
Naming = Version 2 BSIZE = 4096 ASCII-CI = 0 FTYPE =. 1
log = Internal log BSIZE = 1024 Blocks 10240 =, Version 2 =
= = 512 SUnit sectsz BLKS = 0, the lazy-COUNT. 1 =
Realtime = none extsz Blocks = 4096 = 0, 0 = rtextents
----------------- --------------------------------------

4, mkfs.ext3
formatted partition ext3 file system, for example is not described here.

Format:

the mkfs.ext3 [Option] [Device] # option may not be added directly formatted partition ext3


5, mkfs.vfat
this command is formatted U disk, vfat file system type, linux called vfat, called FAT32 under windows, so after the grid, windows linux default are able to know, not the example presented here.

Format:

mkfs.vfat [options] [device] # option may not add directly to the partition formatted as FAT32

6, mkfs.btrfs
Btrfs is a copy (COW) when a new write Linux file system has been incorporated into the mainline kernel. Btrfs design and implementation of advanced features while focusing on fault tolerance, repair and easy to manage. It was developed by Oracle, Red Hat, Fujitsu, Intel , SUSE, STRATO other companies and developers, Btrfs to GNU GPL licensed agreement, while welcoming anyone's contribution. For example presented here bu.

Format:

mkfs.btrfs [Option] [Device] # option may not be added directly formatted partition btrfs

 

 

Third, the use of tools partprobe let the new kernel reads the partition table information

 

When we build a new partition without rebooting the system after the prerequisite for us to format the partition, sometimes an error can not format the partition, the emergence of the above reasons is our new partition, the kernel does not know the new partition after exist, only notify the operating system partition table changes or reboot the system by partprobe command when loading the kernel from the new partition table to identify the partition is formatted so that this command is a command parted package.

 

Usage:
partprobe [options] [device]

 Options:

 -d Do not update the kernel

 -s display a summary of disk partition

 -h Displays help information

 -v display version information

 [Device] here may not reflect the

 

Example: Change Notification operating system partition disk partition table also shows summary information
----------------------------------- --------
[root @ CentOS7 ~] # # partprobe -s command through here can have a good understanding of the number of partitions in the partition table type the number of disks, disk, and the disk in the system. If you do not update the kernel partition table information plus the -d option
/ dev / sda: 1 2 3 gpt Partitions
/ dev / sdb: Partitions 1 2 msdos
/ dev / SDC: gpt Partitions 1
[root @ CentOS7 ~] #
---- ---------------------------------------

Published 136 original articles · won praise 38 · views 260 000 +

Guess you like

Origin blog.csdn.net/Pipcie/article/details/104964788