博客园  :: 首页  :: 管理

关于ext2-ext3-ext4文件系统的创建及基本信息的查看

Posted on 2023-06-30 10:49  520_1351  阅读(106)  评论(0编辑  收藏  举报

本文使用的操作系统:Red Hat Enterprise Linux release 8.7 (Ootpa)

关于ext2-ext3-ext4文件系统的创建, 分别如下:

[root@qq-5201351 ~]# mkfs.ext2 /dev/nvme1n1
[root@qq-5201351 ~]# mkfs.ext3 /dev/nvme1n1
[root@qq-5201351 ~]# mkfs.ext4 /dev/nvme1n1

说明:通过以上3种方式创建出来的文件系统,默认的 Block size 都是4096 Btype,也即4KB

也可以通过 tune2fs 命令进行查看,首先介绍一下tune2fs命令的作用(能同时针对ext2,ext3,ext4)

tune2fs - adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems

因此这个命令也是可以修改ext2/ext3/ext4文件系统的一些信息的,当然查看肯定也是没有问题的,如查看Block大小的方式:

[root@qq-5201351 ~]# tune2fs -l  /dev/nvme1n1 |grep "Block size"
Block size:               4096

 

创建ext2, ext3, ext4时指定 Block的大小

1、对于ext2,ext3,ext4 文件系统、都可以使用-b选项指定Block的大小,目前最小只能指定1024 Byte , 常见的还有2048和4096

如下 为 mke2fs命令的-b指定Block大小的说明 ,  mke2fs - create an ext2/ext3/ext4 filesystem, 是一个通用命令,使用-t 可以指定ext2,ext3 , ext4 

-b block-size
       Specify the size of blocks in bytes.  Valid block-size values are 1024, 2048 and 4096 bytes per block.  If omitted,
       block-size  is heuristically determined by the filesystem size and the expected usage of the filesystem (see the -T
       option).  If block-size is preceded by a negative sign ('-'), then mke2fs will  use  heuristics  to  determine  the
       appropriate  block size, with the constraint that the block size will be at least block-size bytes.  This is useful
       for certain hardware devices which require that the blocksize be a multiple of 2k.

mkfs.ext2/3/4实际可能也是调用mke2fs命令,我们在使用时mkfs.ext2/3/4时,可以使用 mkfs.ext2/3/4 -b 4096 /dev/nvme1n1 的方式即可指定Block的大小

 

 

 

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/17516051.html