Tuesday 22 Jul 2025
Increasing Redundancy in My ZFS Backup Pool
I decided to increase the redundancy of my ZFS backup pool, which stores my entire digital life—photos, videos, music, and media. My current setup consists of three 4TB hard drives in a RAIDZ1 configuration (similar to RAID5). This means that I can afford to lose one drive without losing data. However, if the rebuild fails and another drive dies, I would lose everything on this pool. I have backups elsewhere but would prefer to not spend hours retoring.
To mitigate this risk, I wanted to upgrade to a two-drive redundancy setup using a spare 4TB drive I had. However, this meant I had to destroy my existing pool and start over from scratch. Here's how I did it without losing data:
Step 1: Prepare the New Drive
First, I added the fourth 4TB hard drive to my PC. Next, I removed one of the existing drives from my pool. At this point, the pool wasn’t degraded (which is okay because I had backups).
Step 2: Create a New RAIDZ2 Pool
I tried to create a new RAIDZ2 pool using two of the drives. However, RAIDZ2 requires a minimum of four drives, so I had to create "fake" disks during the setup process. Here's the command I used to simulate the necessary disks:
truncate -s 1G /mnt/disk1.img
truncate -s 1G /mnt/disk2.img
Once the pool was created, I exported it and removed the two fake disks. After that, I imported the pool back into ZFS, which now showed as "degraded."
Step 3: Copy Data to the New Pool
To transfer my data, I used the zfs send command to copy the datasets from the old pool to the new one. This took a long time, but eventually, everything was successfully transferred.
Step 4: Destroy the Old Pool and Attach Drives to the New Pool
Once the data was moved, I destroyed the old pool. I then attached one of the old hard drives at a time to the new RAIDZ2 pool, waiting for the rebuild to complete before attaching the next drive.
pool: rpool2 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 Sat Aug 16 10:34:30 2025 313G / 5.94T scanned at 5.69G/s, 0B / 5.94T issued 0B resilvered, 0.00% done, no estimated completion time config: NAME STATE READ WRITE CKSUM rpool2 DEGRADED 0 0 0 raidz2-0 DEGRADED 0 0 0 ata-Drive1 ONLINE 0 0 0 ata-Drive2 ONLINE 0 0 0 ata-Drive3 ONLINE 0 0 0 replacing-3 DEGRADED 0 0 0 1826073647085818739 UNAVAIL 0 0 0 was /mnt/disk2.img ata-Drive4 ONLINE 0 0 0
Final Setup: A Secure RAIDZ2 Pool
Now, I have a RAIDZ2 pool that allows for the failure of two drives, which significantly increases the redundancy and security of my backup server. This new configuration also gives me more confidence when using older drives, as the system is now protected against multiple drive failures.
pool: rpool2 state: ONLINE scan: resilvered 1.45T in 03:49:32 with 0 errors on Sat Aug 16 14:24:02 2025 config: NAME STATE READ WRITE CKSUM rpool2 ONLINE 0 0 0 raidz2-0 ONLINE 0 0 0 ata-Drive1 ONLINE 0 0 0 ata-Drive2 ONLINE 0 0 0 ata-Drive3 ONLINE 0 0 0 ata-Drive4 ONLINE 0 0 0
Backlinks:
index
Journal:Index
Journal:2025:07