Last active
November 10, 2023 20:00
-
-
Save Davis-A/9c8f0287355dda236dad6267e9d57494 to your computer and use it in GitHub Desktop.
Someone in lobste.rs asked if you could expand a 4 disk raidz3 into a larger and larger pool. The answer is yes! https://lobste.rs/s/roqgoz/zfs_raidz_expansion_merged#c_rqtyqg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@devbox ~]# # --- zfs version ---- | |
[root@devbox ~]# zfs version | |
zfs-2.2.99-0 | |
zfs-kmod-2.2.99-0 | |
[root@devbox ~]# # --- note: 2.2.99 is what you get if you build of master at the moment --- | |
[root@devbox ~]# # --- Create some disks ---- | |
[root@devbox ~]# mkdir -p /root/zfs-sparse/ | |
[root@devbox ~]# truncate -s 16GB /root/zfs-sparse/d1.img | |
[root@devbox ~]# truncate -s 16GB /root/zfs-sparse/d2.img | |
[root@devbox ~]# truncate -s 16GB /root/zfs-sparse/d3.img | |
[root@devbox ~]# truncate -s 16GB /root/zfs-sparse/d4.img | |
[root@devbox ~]# truncate -s 16GB /root/zfs-sparse/d5.img | |
[root@devbox ~]# truncate -s 16GB /root/zfs-sparse/d6.img | |
[root@devbox ~]# truncate -s 16GB /root/zfs-sparse/d7.img | |
[root@devbox ~]# # --- Create the pool ---- | |
[root@devbox ~]# zpool create mypool raidz3 /root/zfs-sparse/d1.img /root/zfs-sparse/d2.img /root/zfs-sparse/d3.img /root/zfs-sparse/d4.img | |
[root@devbox ~]# zpool status | |
pool: mypool | |
state: ONLINE | |
config: | |
NAME STATE READ WRITE CKSUM | |
mypool ONLINE 0 0 0 | |
raidz3-0 ONLINE 0 0 0 | |
/root/zfs-sparse/d1.img ONLINE 0 0 0 | |
/root/zfs-sparse/d2.img ONLINE 0 0 0 | |
/root/zfs-sparse/d3.img ONLINE 0 0 0 | |
/root/zfs-sparse/d4.img ONLINE 0 0 0 | |
errors: No known data errors | |
[root@devbox ~]# # --- Expand the pool ---- | |
[root@devbox ~]# zpool attach mypool raidz3-0 /root/zfs-sparse/d5.img | |
[root@devbox ~]# zpool status | |
pool: mypool | |
state: ONLINE | |
scan: scrub repaired 0B in 00:00:00 with 0 errors on Thu Nov 9 23:13:59 2023 | |
expand: expanded raidz3-0 copied 952K in 00:00:00, on Thu Nov 9 23:13:59 2023 | |
config: | |
NAME STATE READ WRITE CKSUM | |
mypool ONLINE 0 0 0 | |
raidz3-0 ONLINE 0 0 0 | |
/root/zfs-sparse/d1.img ONLINE 0 0 0 | |
/root/zfs-sparse/d2.img ONLINE 0 0 0 | |
/root/zfs-sparse/d3.img ONLINE 0 0 0 | |
/root/zfs-sparse/d4.img ONLINE 0 0 0 | |
/root/zfs-sparse/d5.img ONLINE 0 0 0 | |
errors: No known data errors | |
[root@devbox ~]# # --- Expand the pool again and again ---- | |
[root@devbox ~]# zpool attach mypool raidz3-0 /root/zfs-sparse/d6.img | |
[root@devbox ~]# zpool attach mypool raidz3-0 /root/zfs-sparse/d7.img | |
[root@devbox ~]# zpool status | |
pool: mypool | |
state: ONLINE | |
scan: scrub repaired 0B in 00:00:00 with 0 errors on Thu Nov 9 23:16:42 2023 | |
expand: expanded raidz3-0 copied 1.73M in 00:00:01, on Thu Nov 9 23:16:42 2023 | |
config: | |
NAME STATE READ WRITE CKSUM | |
mypool ONLINE 0 0 0 | |
raidz3-0 ONLINE 0 0 0 | |
/root/zfs-sparse/d1.img ONLINE 0 0 0 | |
/root/zfs-sparse/d2.img ONLINE 0 0 0 | |
/root/zfs-sparse/d3.img ONLINE 0 0 0 | |
/root/zfs-sparse/d4.img ONLINE 0 0 0 | |
/root/zfs-sparse/d5.img ONLINE 0 0 0 | |
/root/zfs-sparse/d6.img ONLINE 0 0 0 | |
/root/zfs-sparse/d7.img ONLINE 0 0 0 | |
errors: No known data errors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment