![4K 扇区磁盘上的 ZFS RAIDZ2 的开销去哪儿了?](https://linux22.com/image/631952/4K%20%E6%89%87%E5%8C%BA%E7%A3%81%E7%9B%98%E4%B8%8A%E7%9A%84%20ZFS%20RAIDZ2%20%E7%9A%84%E5%BC%80%E9%94%80%E5%8E%BB%E5%93%AA%E5%84%BF%E4%BA%86%EF%BC%9F.png)
我首先创建了 16 个大小恰好为 10 亿字节的空文件:
for i in {1..16}; do dd if=/dev/zero of=/mnt/temp/block$i bs=1000000 count=1000 &> /dev/null; done
然后,我在文件上创建了越来越大的 RAIDZ2 卷,强制 ashift=12 来模拟 4K 扇区驱动器,例如
zpool create tank raidz2 -o ashift=12 /mnt/temp/block1 /mnt/temp/block2...
然后进行比较df -B1
以查看实际尺寸。
Filesystem 1B-blocks
tank 12787777536
我的结果:
+-------+-------------+-------------+------------+------------+
| disks | expected | actual | overhead | efficiency |
+-------+-------------+-------------+------------+------------+
| 3 | 1000000000 | 951975936 | 48024064 | 95.2 |
| 4 | 2000000000 | 1883766784 | 116233216 | 94.2 |
| 5 | 3000000000 | 2892234752 | 107765248 | 96.4 |
| 6 | 4000000000 | 3892969472 | 107030528 | 97.3 |
| 7 | 5000000000 | 4530896896 | 469103104 | 90.6 |
| 8 | 6000000000 | 5541068800 | 458931200 | 92.4 |
| 9 | 7000000000 | 6691618816 | 308381184 | 95.6 |
| 10 | 8000000000 | 7446331392 | 553668608 | 93.1 |
| 11 | 9000000000 | 8201175040 | 798824960 | 91.1 |
| 12 | 10000000000 | 8905555968 | 1094444032 | 89.1 |
| 13 | 11000000000 | 10403577856 | 596422144 | 94.6 |
| 14 | 12000000000 | 11162222592 | 837777408 | 93.0 |
| 15 | 13000000000 | 12029263872 | 970736128 | 92.5 |
| 16 | 14000000000 | 12787908608 | 1212091392 | 91.3 |
+-------+-------------+-------------+------------+------------+
如下图所示:
- 我的结果正确吗?或者我遗漏了什么?
- 如果他们是正确的,为什么?空间将去往何处?
- 我能做些什么来提高效率?
- 有没有计算效率的公式?