今天笔者看到mkfs.xfs命令的帮助文档手册时,有如下一段内容
可以通过-b size=value 的方式指定 block的大小,默认值是4096 bytes,最小为512 ,最大为65536
The default value is 4096 bytes (4KiB),
the minimum is 512, and the maximum is 65536 (64 KiB).
于是笔者就尝试,创建xfs文件系统,指定block的大小为512,结果报错:Minimum block size for CRC enabled filesystems is 1024 bytes.
笔者看到关键词有CRC,即开启了CRC所以要求最小要为1024字节,那么是否意味着CRC关闭了就没有这个限制呢?
继续查看mkfs.xfs命令的选项,发现有一个 -m crc=0|1 看来CRC的开关应该就在这里了,于是再次测试,成功~
[root@qq-5201351 ~]# mkfs.xfs -f -m crc=0 -b size=512 /dev/nvme1n1 meta-data=/dev/nvme1n1 isize=256 agcount=8, agsize=1310720 blks = sectsz=512 attr=2, projid32bit=1 = crc=0 finobt=0, sparse=0, rmapbt=0 = reflink=0 bigtime=0 inobtcount=0 data = bsize=512 blocks=10485760, imaxpct=25 = sunit=8 swidth=8 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=512 blocks=20480, version=2 = sectsz=512 sunit=8 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@qq-5201351 ~]#
那么CRC到底是干嘛的、作用是什么呢?其实简单地说,CRC主要可以增强错误检测,同时格式更改还可以改进崩溃恢复算法
By default mkfs.xfs will enable CRC which forces a 1024 byte block. Turn off CRC to get 512 byte block.
CRC enables enhanced error detection due to hardware issues, whilst the format changes also improves crash recovery algorithms
and the ability of various tools to validate and repair metadata corruptions when they are found.Disabling CRC is a trade-off with file-system consistency.
因此笔者也就建议在生产环境,我们应该遵循mkfs.xfs命令的CRC默认开启,block的大小就设置为1024及更大~
尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/17478703.html
标签:CRC,mkfs,xfs,512,block,size From: https://www.cnblogs.com/5201351/p/17478703.html