如何挂载块大小为65536的ext4 fs?

3 linux mount filesystems ext4

我正在对 Compact Flash 介质上的 EXT4 性能进行基准测试。

我创建了一个块大小为 65536 的 ext4 fs。但是我无法将其安装在 ubuntu-10.10-netbook-i386 上(它已经安装了块大小为 4096 字节的 ext4 fs)

根据我对 ext4 的阅读,它应该允许这么大的块大小的文件系统。我想听听你的意见。

root@ubuntu:~# mkfs.ext4 -b 65536  /dev/sda3
Warning: blocksize 65536 not usable on most systems.
mke2fs 1.41.12 (17-May-2010)
mkfs.ext4: 65536-byte blocks too big for system (max 4096)
Proceed anyway? (y,n) y
Warning: 65536-byte blocks too big for system (max 4096), forced to continue
Filesystem label=
OS type: Linux
Block size=65536 (log=6)
Fragment size=65536 (log=6)
Stride=0 blocks, Stripe width=0 blocks
19968 inodes, 19830 blocks
991 blocks (5.00%) reserved for the super user
First data block=0
1 block group
65528 blocks per group, 65528 fragments per group
19968 inodes per group

Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.



root@ubuntu:~# tune2fs -l /dev/sda3
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          4cf3f507-e7b4-463c-be11-5b408097099b
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index
filetype extent flex_bg sparse_super large_file huge_file uninit_bg
dir_nlink extra_isize
Filesystem flags:         signed_directory_hash
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              19968
Block count:              19830
Reserved block count:     991
Free blocks:              18720
Free inodes:              19957
First block:              0
Block size:               65536
Fragment size:            65536
Blocks per group:         65528
Fragments per group:      65528
Inodes per group:         19968
Inode blocks per group:   78
Flex block group size:    16
Filesystem created:       Sat Feb  5 14:39:55 2011
Last mount time:          n/a
Last write time:          Sat Feb  5 14:40:02 2011
Mount count:              0
Maximum mount count:      37
Last checked:             Sat Feb  5 14:39:55 2011
Check interval:           15552000 (6 months)
Next check after:         Thu Aug  4 14:39:55 2011
Lifetime writes:          70 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      afb5b570-9d47-4786-bad2-4aacb3b73516
Journal backup:           inode blocks


root@ubuntu:~# mount -t ext4 /dev/sda3 /mnt/
mount: wrong fs type, bad option, bad superblock on /dev/sda3,
      missing codepage or helper program, or other error
      In some cases useful info is found in syslog - try
      dmesg | tail  or so
Run Code Online (Sandbox Code Playgroud)

phu*_*clv 7

AFAIK ext2/3/4 基于通用 Linux VFS 框架,该框架要求块大小小于或等于页面大小

如果块大小大于页面大小(即 i386 上只有 4KiB 内存页面的 64KiB 块),您可能会遇到安装问题。

https://www.kernel.org/doc/html/latest/filesystems/ext4/overview.html

关于解决大区块问题进行了一些讨论

不幸的是,目前还几乎没有重大进展


但是,由于您只是想测试速度,因此我建议使用bigalloc,它在大集群而不是大块中分配。例如创建一个 64KB 簇的 ext4 分区

dd if=/dev/zero of=ext4.bigalloc bs=1M count=256
mkfs.ext4 -C 65535 -O bigalloc ext4.bigalloc
sudo mount -o loop ext4.bigalloc /mnt
Run Code Online (Sandbox Code Playgroud)

该选项是Linux 3.2内核中的新选项,调用时必须指定该选项,mkfs.ext4如上所示

  • -C簇的大小
    • 使用 bigalloc 功能指定文件系统的簇大小(以字节为单位)。每个簇的有效簇大小值为 2048 到 256M 字节。仅当启用 bigalloc 功能时才能指定此值。(有关 bigalloc 的更多详细信息,请参阅ext4 (5)手册页。)如果启用 bigalloc,则默认簇大小是块大小的 16 倍。

http://manpages.ubuntu.com/manpages/trusty/man8/mke2fs.8.html

此功能仍在开发中,因此请谨慎使用。但由于您在基准测试时通常不关心文件损坏,因此这可能是最好的选择


也就是说,限制仅在内核驱动程序中,您仍然可以使用FUSE 驱动程序挂载分区。一些例子:

如果您只想复制数据,那么您可以使用debugfs,但它对于基准测试不太有用。即使 FUSE 的性能也可能不足以测量设备速度