一般情况下,XFS出现丢数据的情况为海量小文件IO场景。在该场景下,inode占用教大。
通过上文的方式进行格式化,inode数量较小。通过大量测试,可以使用如下方法提升mkfs.ext4后文件系统性能。
方法主要内容:在/etc/mke2fs.conf文件,ext4配置中去开启64位功能。
[[email protected] ~]# cat /etc/mke2fs.conf
[defaults]
base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr
blocksize = 4096
inode_size = 256
inode_ratio = 16384
[fs_types]
ext3 = {
features = has_journal
}
ext4 = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
auto_64-bit_support = 1 ###新增加行,告诉系统使用64位方式进行格式化。避免mkfs.ext4直接报错。
inode_size = 256
}
ext4dev = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
inode_size = 256
options = test_fs=1
}
small = {
blocksize = 1024
inode_size = 128
inode_ratio = 4096
}
floppy = {
blocksize = 1024
inode_size = 128
inode_ratio = 8192
}
news = {
inode_ratio = 4096
}
largefile = {
inode_ratio = 1048576
blocksize = -1
}
largefile4 = {
inode_ratio = 4194304
blocksize = -1
}
hurd = {
blocksize = 4096
inode_size = 128
}
[[email protected] ~]#
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 259G 29G 217G 12% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/sda1 194M 34M 151M 19% /boot
/dev/sdf1 39T 21T 18T 54% /mnt/source
/dev/md127 5.4T 1.8T 3.4T 35% /public
/dev/sdg1 22T 42G 21T 1% /mnt/public_back
[[email protected] ~]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda3 17195008 383263 16811745 3% /
tmpfs 4106354 1 4106353 1% /dev/shm
/dev/sda1 51200 41 51159 1% /boot
/dev/sdf1 8203124224 34192419 8168931805 1% /mnt/source ###XFS文件系统,40T容量。
/dev/md127 366288896 2338559 363950337 1% /public
/dev/sdg1 1464844288 295 1464843993 1% /mnt/public_back ###ext4文件系统,22T容量。