【系列】每天一个 Linux 命令(22):mkfs.ext4 命令
发布作者:微思网络 发布时间:2026-01-12 浏览量:0次
mkfs.ext4命令来自英文词組make filesystem Ext4的缩写其功能是对磁盘设备进行EXT4格式化操作。
1.命令格式:
mkfs.ext4 参数 设备名
2.常用参数:
-b设置文件数据块大小 -c格式化前检查分区是否有坏块 -E设置文件系统扩展选项 -f以字节为单位指定片段大小 -F强制格式化而不询问 -g设置一个块组中的块数 -i设置字节和节点的比率 -I设置每个节点的大小 -I读取文件名中的坏块列表 -m设置为管理员保留的文件系统块的百分比 -M设置文件系统的最后挂载目录 -o覆盖文件系统的"创建者操作系统"字段的默认值 -O使用指定的特性创建一个文件系统 -q静默执行模式 -t设置要创建的文件系统类型 -U使用指定的UUID创建文件系统 -V显示版本信息
3.参考示例:
检查指定的磁盘设备并进行格式化操作:[root@linuxcool ~]#mkfs.ext4 -c /dev/sdbmke2fs 1.44.3 (10-July-2018)Creating filesystem with 5242880 4k blocks and 1310720 inodesFilesystem UUID:2468ba17-0d37-4900-b67e-5f3a24084fc5Superblock backups stored on blocks:32768,98304,163840,229376,294912,819200,884736,1605632,2654208,4096000Checking for bad blocks (read-only test): 0.00% done, 0:00 elapsed. (0/0/0errdoneAllocating group tables: doneWriting inode tables: doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done
对指定的磁盘设备直接进行格式化操作:[root@linuxcool ~]# mkfs.ext4 /dev/sdbmke2fs 1.44.3 (10-July-2018)Creating filesystem with 5242880 4k blocks and 1310720 inodesFilesystem UUID: 62ccf385-efef-41ab-8938-bfd65bac7066Superblock backups stored on blocks:32768,98304,163840,229376,294912,819200,884736,1605632,2654208,4096000Allocating group tables: doneWriting inode tables: doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done
对指定的磁盘设备进行格式化操作,保留5%容量给管理员:[root@linuxcool ~]# mkfs.ext4 -m 5 /dev/sdbmke2fs 1.44.3 (10-July-2018)Creating filesystem with 5242880 4k blocks and 1310720 inodesFilesystem UUID: a3a61300-5195-44c7-belc-dcf9ba0fbfbeSuperblock backups stored on blocks:32768,98304,163840,229376,294912,819200,884736, 1605632,2654208,4096000Allocating group tables:doneWriting inode tables: doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done
对指定的磁盘设备进行格式化操作,添加卷标识,并修改块大小:[root@linuxcool ~]#mkfs.ext4 -L 'LinuxCool'-b 2048 /dev/sdbmke2fs 1.44.3 (10-July-2018)Creating filesystem with 10485760 2k blocks and 1310720 inodesFilesystem UUID: 73ad248c-2a01-49dd-aa46-8770ecbc56fdSuperblock backups stored on blocks:16384,49152,81920,114688,147456,409600,442368,802816,1327104,2048000,3981312,5619712,10240000Allocating group tables: doneWriting inode tables: doneCreating journal (65536 blocks): doneWriting superblocks and filesystem accounting information: done
END
1微思网络,始于2002年
专业IT认证培训23年,面向全国招生!
点击查看更多【培训课程目录】


