Loading... [ ](https://www.bilibili.com/video/BV1FT4y1972V/) # 介绍 众所周知,zfs的RAIDZ扩展非常的不友好,这个[RAID-Z Expansion功能](https://freebsdfoundation.org/blog/raid-z-expansion-feature-for-zfs/)实现了,单盘扩展。本篇文章就是自己编译zfs,合并RAID-Z Expansion # 结论 结论放在前面 如图完成了单盘扩展,没有任何问题  # 编译 平台介绍: Debian11 x86-64 ## 安装依赖 ``` apt update ``` ``` sudo apt install build-essential autoconf automake libtool gawk alien fakeroot dkms libblkid-dev uuid-dev libudev-dev libssl-dev zlib1g-dev libaio-dev libattr1-dev libelf-dev linux-headers-$(uname -r) python3 python3-dev python3-setuptools python3-cffi libffi-dev python3-packaging git libcurl4-openssl-dev ``` ## 拉取仓库,[合并PR](https://github.com/openzfs/zfs/pull/12225) ``` git clone https://github.com/openzfs/zfs cd zfs ``` ``` git fetch -t https://github.com/openzfs/zfs.git refs/pull/12225/head ``` ``` git reset --hard bee78bb015f2376a82b02b2674eb4ed28c4af82b -- ``` ``` git branch -M refs/pull/12225/head ``` ## 配置和编译 ``` sh autogen.sh ./configure make -s -j$(nproc) ``` ``` make deb ``` # 安装 ``` dpkg -i *.deb ``` ## 加载模块 ``` /sbin/modprobe zfs ``` # 测试 ``` zfs version ``` 查看版本 ## 创建池 ``` root@debian:~# fdisk -l |grep Disk Disk /dev/sdd: 10 GiB, 10737418240 bytes, 20971520 sectors Disk model: VMware Virtual S Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors Disk model: VMware Virtual S Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors Disk model: VMware Virtual S Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors Disk model: VMware Virtual S Disk /dev/sde: 20 GiB, 21474836480 bytes, 41943040 sectors Disk model: VMware Virtual S Disklabel type: dos Disk identifier: 0xa7bd801e root@debian:~# zpool create test raidz1 sdd sdc sdb root@debian:~# zpool list NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT test 29.5G 193K 29.5G - - 0% 0% 1.00x ONLINE - ``` 查看池状态 ``` root@debian:~# zpool status -v test pool: test state: ONLINE config: NAME STATE READ WRITE CKSUM test ONLINE 0 0 0 raidz1-0 ONLINE 0 0 0 sdd ONLINE 0 0 0 sdc ONLINE 0 0 0 sdb ONLINE 0 0 0 errors: No known data errors ``` 测试扩展单盘 ``` root@debian:~# zpool attach test raidz1-0 sda ``` 查看池状态 ``` root@debian:~# zpool status -v test pool: test state: ONLINE raidz expand: Expansion of vdev 0 copied 410K in 0h0m, completed on Sat Feb 12 16:21:48 2022 config: NAME STATE READ WRITE CKSUM test ONLINE 0 0 0 raidz1-0 ONLINE 0 0 0 sdd ONLINE 0 0 0 sdc ONLINE 0 0 0 sdb ONLINE 0 0 0 sda ONLINE 0 0 0 errors: No known data errors ``` 成功扩展! [编译好的deb包(7天后过期)](https://minio.sagithome.com:9443/share/zfs.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=SNZ0PTJCYMGP4EWZC215%2F20220212%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220212T084057Z&X-Amz-Expires=604800&X-Amz-Security-Token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyIiOiJjb25zb2xlQWRtaW4iLCJhY2Nlc3NLZXkiOiJTTlowUFRKQ1lNR1A0RVdaQzIxNSIsImV4cCI6MzYwMDAwMDAwMDAwMH0.WgGltwgQe8IZb4ywom06FOZjaCF_Olx9ePslLQbMplejJOksq1Q5AeZ6fcOf1qooasxrdR-B_vHbqc5ejuh44Q&X-Amz-SignedHeaders=host&versionId=null&X-Amz-Signature=3543d2fae7f0af9d4f9dec4e6b8638f21a68b0683e6a85a8236e630c6d7babd1) 最后修改:2022 年 06 月 02 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 2 如果觉得我的文章对你有用,请随意赞赏
3 条评论
Couldn't find any package by glob 'linux-headers-5.10.142+truenasf'
请问有具体的pkg的编号吗?
您好,请问在trunas scale下怎么安装使用呢?apt update 这步就过不去。我是linux小白。谢谢
这只是测试,scale不能用