前面讲到,mkfs 命令为硬盘分区写入文件系统时,无法手动调整分区的默认参数(比如块大小是 4096 Bytes),如果想要调整,就需要使用本节介绍的 mke2fs 命令。
mke2fs 命令的基本格式如下:
[root@localhost ~]# mke2fs [选项] 分区设备文件名
表 1 罗列出了 mke2fs 命令常用的几个选项及各自的功能。
| 选项 | 功能 | 
|---|---|
| -t 文件系统 | 指定格式化成哪个文件系统, 如 ext2、ext3、ext4; | 
| -b 字节 | 指定 block 的大小; | 
| -i 字节 | 指定"字节 inode "的比例,也就是多少字节分配一个 inode; | 
| -j | 建立带有 ext3 日志功能的文件系统; | 
| -L 卷标名 | 给文件系统设置卷标名,就不使用 e2label 命令设定了; | 
为了更好的对比 mkfs 命令,这里我们依旧以格式化 /dev/sdb6 为例,不过,这次使用的是 mke2fs 命令,执行命令如下:
	[root@localhost ~]# mke2fs -t ext4 -b 2048 /dev/sdb6
	#格式化分区,并指定block的大小为2048 Bytes
	mke2fe 1.41.12 (17-May-2010)
	Filesystem label=
	OS type:Linux
	Block size=2048 (log=1)  <--block 的大小配置为 2K
	Fragment size=2048 (log=1)
	Stride=0 blocks, Stripe width=0 blocks 131560
	inodes,1052240 blocks 52612 blocks (5.00%) reserved for the super user
	First data block=0
	Maximum filesystem blocks=538968064 65 block groups
	16384 blocks per group, 16384 fragments per group
	2024 inodes per group
	Superblock backups stored on blocks:
	16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816
	Writing inode tables: done
	Creating journal (32768 blocks):done
	Writing superblocks and filesystem accounting information:done
	This filesystem will be automatically checked every 38 mounts or 180 days, whichever comes first. Use tune2fs -c or-i to override.
如果没有特殊需要,建议使用 mkfs 命令对硬盘分区进行格式化。
更多...
加载中...