Creating a degraded ZFS pool

Posted: | Tags: storage homelab status

TL;DR: There may come a time when you need to build a ZFS pool in a temporarily degraded state. Reddit user u/mercenary_sysadmin describes how this is done, and this post provides additional commentary.

The approach uses a temporary file in place of the disk, then taking it offline resulting in a degraded pool. When the physical disk is available, the file can be replaced with the actual disk in the pool.


My desktop sits idle most of the time as I’ve switched to using my laptop for day-to-day tasks, which seemed like a waste of hardware. Meanwhile, my NAS, running off an 8TB WD Elements drive connected via USB to a ThinkCentre M93p, could use an upgrade. The plan was to set up my desktop as the new NAS with four 8TB WD drives in RAID-Z1. I already have the drives, plus one spare, lying around, so I thought it would be an easy installation, but two of the drives were dead. This left me with three good drives plus the WD Elements, which I then had to shuck. A backup of all critical data was already in place but the restore would have taken too much time, so I made the decision to set up a degraded ZFS pool with the three drives, copy the data over from the WD Elements, shuck it, and then introduce it to the pool.

After installing the three working 8TB drives, verifying their health via smartctl, I set up the pool with a file, created through truncate, in place of the fourth disk. Also, if you plan to follow along, replace ostrich with your pool name.

$ truncate -s 8T /tmp/disk4.bin
$ zpool create ostrich -o ashift=12 raidz1 /dev/sda /dev/sdb /dev/sdc /tmp/disk4.bin

Before copying the data over, take the file offline, or it will begin to fill.

$ zpool offline ostrich /tmp/disk4.bin
$ rm /tmp/disk4.bin

At this point, running zpool status ostrich, you will confirm that the device is offline and the pool is in a degraded state. Next, I copied the data over, and once complete, ran a scrub to verify the data was intact. You can keep tabs on the scrubbing, which can take a while, by calling the zpool status with the watch command.

$ zpool scrub ostrich
$ watch zpool status ostrich -v

This revealed something scary: a data error.

 pool: ostrich
 state: DEGRADED
status: One or more devices has experienced an error resulting in data
 corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
 entire pool from backup.
 see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
 scan: scrub repaired 0B in 02:02:54 with 1 errors on Sun Jul 20 10:37:58 2025
config:

 NAME                STATE     READ WRITE CKSUM
 ostrich             DEGRADED     0     0     0
 raidz1-0          DEGRADED    23     0     0
 sda             ONLINE       0     0     0
 sdb             DEGRADED    24     0     0  too many errors
 sdc             ONLINE       0     0     0
 /tmp/disk4.bin  OFFLINE      0     0     0

errors: Permanent errors have been detected in the following files:

 /ostrich/<file-path-omitted>

Disk /dev/sdb had “too many errors” with a permanent error in a file. I double-checked the smartctl, which still checked out, replaced the file in question, cleared the errors and scrubbed again. This time, once complete, all looked good.

Next, I shucked and installed the drive into the desktop and used zpool replace to swap out the file for the disk.

$ zpool replace ostrich /tmp/disk4.bin /dev/sdd

After this command, you’ll be able to watch the pool resilver.

$ watch zpool status ostrich -v

 pool: ostrich
 state: DEGRADED
status: One or more devices is currently being resilvered.  The pool will
 continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
 scan: resilver in progress since Tue Jul 22 17:07:18 2025
 1.22T / 5.01T scanned at 59.5G/s, 6.23G / 5.01T issued at 304M/s
 1.47G resilvered, 0.12% done, 04:47:42 to go
config:

 NAME                  STATE     READ WRITE CKSUM
 ostrich               DEGRADED     0     0     0
 raidz1-0            DEGRADED     0     0     0
 sda               ONLINE       0     0     0
 sdb               ONLINE       0     0     0
 sdc               ONLINE       0     0     0
 replacing-3       DEGRADED     0     0     0
 /tmp/disk4.bin  OFFLINE      0     0     0
 sdd             ONLINE       0     0     0  (resilvering)

errors: No known data errors

That’s all!


Related ramblings