Stupid ZFS tricks — expanding zraid

# scrub first to make sure you have no looming read errors
zpool scrub oldarray
# set old array to readonly if you can
...
# take one disk out of the existing array
...
# create a couple of sparse files that will be fake members
# of the new array:
truncate -s 8001563222016 /tmp/FD1.img
truncate -s 8001563222016 /tmp/FD2.img
truncate -s 8001563222016 /tmp/FD3.img
# create the new array
zpool create -f newarray \
-o feature@userobj_accounting=disabled \
-o feature@edonr=disabled \
-o feature@project_quota=disabled \
-o feature@allocation_classes=disabled \
-o feature@resilver_defer=disabled \
raidz3 \
ata-TOSHIBA_MD04ACA500_Y5R7K9CXFS9A-part4 \
ata-TOSHIBA_MD04ACA500_Y5N8K655FS9A-part4 \
ata-TOSHIBA_HDWE150_19MRK03SFB9G-part4 \
ata-TOSHIBA_HDWE150_19HRK02NFB9G-part4 \
ata-TOSHIBA_HDWE150_98I4K05WFB9G-part4 \
/tmp/FD[123].img
# that command also turns off features that will make a Linux
# zpool unreadable under FreeBSD and Solaris.
# Now, as fast as possible take the fake devices out of the array:
zpool offline newarray /tmp/FD1.img
zpool offline newarray /tmp/FD2.img
zpool offline newarray /tmp/FD3.img
# you do that as fast as possible since the resilver will fill the
# sparse files with actual data.
# now you can copy the data:
zfs snapshot -r oldarray@tonewarray
zfs send -R oldarray@tonewarray | zfs recv -Fdu newarray
# if the copy succeeds move on to remove disks from oldarray
# and add them to newarray

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store