RedHat/CentOS ext4无法格式化大分区 补充ext4格式化方式
一般情况下,XFS出现丢数据的情况为海量小文件IO场景。在该场景下,inode占用教大。
通过上文的方式进行格式化,inode数量较小。通过大量测试,可以使用如下方法提升mkfs.ext4后文件系统性能。
方法主要内容:在/etc/mke2fs.conf文件,ext4配置中去开启64位功能。
[root@node21 ~]# 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
}
[root@node21 ~]#
[root@node21 ~]# 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
[root@node21 ~]# 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容量。
Linux 之 ext2/EXT3文件系统初识 http://www.linuxidc.com/Linux/2013-02/79839.htm
无损升级EXT3至ext4文件系统 http://www.linuxidc.com/Linux/2013-02/80132.htm
EXT3与EXT4的主要区别 http://www.linuxidc.com/Linux/2014-10/107929.htm
更多RedHat相关信息见RedHat 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=10
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-10/108588.htm
红帽/CentOS 6.5的e2fsprogs版本为1.41.12较低,无法创建16TB以上的文件系统
下载最新的e2fsprogs,编译安装
ftp://ftp.ntu.edu.tw/linux/kernel/people/tytso/e2fsprogs/
tar zxvf e2fsprogs-1.42.10.tar.gz
cd e2fsprogs-1.42.10
mkdir build
cd build/
../configure
make
make install
mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize -i 4194304 /dev/sda1
mount /dev/sda1 /mnt
常见故障表现:
[root@localhost ~]# mount /dev/sda1 /mnt/
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog – try
dmesg | tail or so
[root@localhost ~]# mkfs.ext4 /dev/sda1
mke2fs 1.41.12 (17-May-2010)
mkfs.ext4: Size of device /dev/sda1 too big to be expressed in 32 bits
using a blocksize of 4096.
[root@localhost ~]# mkfs.ext4 -b 8192
Warning: blocksize 8192 not usable on most systems.
mke2fs 1.41.12 (17-May-2010)
mkfs.ext4: 8192-byte blocks too big for system (max 4096)
Proceed anyway? (y,n) y
Warning: 8192-byte blocks too big for system (max 4096), forced to continue
Filesystem label=
OS type: Linux
Block size=8192 (log=3)
Fragment size=8192 (log=3)
Stride=0 blocks, Stripe width=0 blocks
1464926208 inodes, 2929459075 blocks
146472953 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4311218176
44706 block groups
65528 blocks per group, 65528 fragments per group
32768 inodes per group
Superblock backups stored on blocks:
65528, 196584, 327640, 458696, 589752, 1638200, 1769256, 3210872,
5307768, 8191000, 15923304, 22476104, 40955000, 47769912, 143309736,
157332728, 204775000, 429929208, 1023875000, 1101329096, 1289787624