如何使用大于16TB的ext4文件系统

如题所述

很多人用mkfs.ext4尝试不通之后,就改用xfs了。
而实际上,这个问题早有人解决了,解决方法起始也比较简单。
http //blog ronnyegner-consulting de/2011/08/18/ext4-and-the-16-tb-limit-now-solved/
http //rritw com/a/JAVAbiancheng/ANT/20101003/43604 html

原来EXT4是真的支持1EiB的文件系统的,只是mkfs无法支持大于16T的文件系统,所以只需要升级一下格式化工具即可。
关于为什么mkfs.ext4不能格式化大于16T的Ext4文件系统以及其解决方法,原文解释如下:
To be specific: Even with the most recent e2fsprogs 1.41.14 there is no way to create file systems larger than 16 TB.

But: According to this post it should work since June:

It’s taken way too long, but I’ve finally finished integrating the 64-bit patches into e2fsprogs’s mainline repository. All of the necessary patches should now be in the master branch for e2fsprogs. The big change from before is that I replaced Val’s changes for fixing up how mke2fs picked the correct fs-type profile from mke2fs.conf with something that I think works much better and leaves the code much cleaner. With this change you need to add the following to your /etc/mke2fs.conf file if you want to enable the 64-bit feature flag automatically for a big disk:

[fs_types] ext4 = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
auto_64-bit_support = 1 # <—- add this line
inode_size = 256
}

Alternatively you can change the features line to include the feature “64bit”; this will force the use of the 64-bit fields, and double the size of the block group descriptors, even for smaller file systems that don’t require the 64-bit support. (This was one of my problems with Val’s implementation; it forced the mke2fs.conf file to always enable the 64-bit feature flag, which would cause backwards compatibility issues.) This might be a good thing to do for debugging purposes, though, so this is an option which I left open, but the better way of doing things is to use the auto_64-bit-support flag.

所以,只需要升级下工具即可,升级方式如下:
git clone git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
cd e2fsprogs
./configure
make && make install

完毕之后还是不能用mkfs.ext4来格式化,而要用“mke2fs”进行格式化,命令参考如下:
mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize -i 4194304 /dev/md0

需要注意的是,这是一个还在开发中的工具,使用请个人承担风险:
This are *development* tools – use at your OWN RISK

格式化完毕后就挂载了,来看看你的超大EXT4文件系统吧:
mount -t ext4 /dev/md0 /mnt

mount|grep md0
/dev/md0 on /cache/data type ext4 (rw)

df -h
/dev/md0 19T 229M 18T 1% /mnt

最后,E文作者总结了这么几点,Conclusion:
With the most recent e2fstools (1.42-WIP) it is possible to create ext4 file system larger than 16 TB.

If you do so remember the following:

the tool is still in development – use at your own risk!
tune the values for autocheck (after x mounts / after y days)
adjust the “-i” switch which defines the bytes/inode ratio; in the example above one inode is created for every 8 MB
the more inodes you create the longer fsck takes and the more memory it needs
Resizing the file system (growing / shrinking) is NOT possible at the moment
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答