介绍

众所周知,zfs的RAIDZ扩展非常的不友好,这个RAID-Z Expansion功能实现了,单盘扩展。本篇文章就是自己编译zfs,合并RAID-Z Expansion

结论

结论放在前面
如图完成了单盘扩展,没有任何问题

image.png

编译

平台介绍: 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

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天后过期)

最后修改:2022 年 06 月 02 日
感谢您的支持