服务器之家:专注于VPS、云服务器配置技术及软件下载分享
分类导航

Linux|Centos|Ubuntu|系统进程|Fedora|注册表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服务器之家 - 服务器系统 - Linux - Linux分区格式化的命令

Linux分区格式化的命令

2022-07-16 10:41揅笑晏晏 Linux

当硬盘分区完成后,需要对分区进行格式化。 下面小编给大家带来了Linux分区格式化的命令,感兴趣的朋友一起看看吧

当硬盘分区完成后,需要对分区进行格式化。

使用mkfs工具对硬盘分区进行格式化,支持MBR和GPT两种分区表。

命令1:格式化sdb1分区为ext3格式

mkfs.ext3 /dev/sdb1

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
  32768, 98304, 163840, 229376, 294912

正在写入inode表: 完成                           

?
1
2
3
4
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

命令2:格式化sdb5分区为ext4格式

mkfs -t ext4 /dev/sdb5

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
  32768, 98304, 163840, 229376, 294912
正在写入inode表: 完成             
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

p.s.

MBR分区表磁盘中的扩展分区不能格式化,即只能格式化主分区和逻辑分区;
格式化操作是即时生效的,不需要重启Linux系统,但此时用df命令并不能查看到磁盘的文件系统和类型,原因是还没有进行挂载。

?
1
2
3
df -hT /dev/sdb1
Filesystem   Type Size Used Avail Use% Mounted on
-       -   492M 260K 491M  1% /dev

总结

以上所述是小编给大家介绍的Linux分区格式化的命令,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

原文链接:https://blog.csdn.net/llllllyyy/article/details/81599270

延伸 · 阅读

精彩推荐