RAIDZ-1 vs Mirrored VDEVs: Optimal ZFS Configuration for 4x2TB Drives Under Budget Constraints


1 views

The debate around RAIDZ-1 stems from its similarity to traditional RAID-5 in terms of single parity protection. With 4x2TB drives, you'd get approximately 6TB usable space (after accounting for ~10% ZFS overhead), compared to 4TB in your current RAID10 setup.

# Theoretical capacity calculation:
4 x 2TB = 8TB raw
RAIDZ-1: (n-1) x disk_size = 3 x 2TB = 6TB usable
Mirrored: (n/2) x disk_size = 2 x 2TB = 4TB usable

The primary concern with RAIDZ-1 emerges during resilvering (drive replacement). A 2TB drive resilver can take 5-10 hours on SATA hardware, during which:

  • Bit rot detection increases read operations
  • Second drive failure probability rises significantly
  • Write operations further stress the array

For a home NAS with your specs (8GB RAM, WD RE4-GP drives), performance differences become marginal:

# zfs create -o recordsize=1M tank/data  # Optimal for media storage
# zfs set compression=lz4 tank           # Enable LZ4 compression
# zfs set atime=off tank                 # Disable access time updates

Given your budget constraints, here are two viable approaches:

Option 1: Mirrored VDEVs (Recommended)

zpool create tank mirror sda sdb mirror sdc sdd
zfs set compression=lz4 tank
zfs set recordsize=1M tank/media

Pros: Faster resilvering (~2-3 hours per mirror), better random I/O performance
Cons: 33% less usable space than RAIDZ-1

Option 2: RAIDZ-1 with Mitigations

zpool create tank raidz1 sda sdb sdc sdd
zfs set compression=lz4 tank
zfs set copies=2 tank/critical_data  # Extra protection for important files

Pros: 50% more usable space
Cons: Higher risk during resilvering, slower random writes

Implement these cron jobs for either configuration:

# Weekly scrub
0 3 * * 0 /sbin/zpool scrub tank

# SMART monitoring
0 * * * * /usr/sbin/smartctl -H /dev/sd[a-d] | mail -s "SMART Status" admin@example.com

# Capacity alert
0 8 * * * [ $(zfs list -H -o used tank) -gt 85 ] && echo "Storage >85%" | mail -s "Capacity Alert" admin@example.com

Choose RAIDZ-1 if:

  • Your data is largely replaceable (media library)
  • You maintain verified backups elsewhere
  • You can tolerate potential downtime during recovery

Choose mirrors if:

  • You need maximum reliability
  • Performance matters for your workload
  • You can live with less space after compression gains

When dealing with 4x2TB drives in FreeNAS, the RAIDZ-1 debate often centers around two key factors: the URE (Unrecoverable Read Error) probability during rebuilds and the practical implications of single-parity protection. For WD RE4-GP drives with a specified URE rate of 1 in 10^14 bits, the probability of encountering a URE during a full 2TB rebuild is:

Probability = 1 - (1 - (1/10^14))^(2*8*10^12) ≈ 14.8%

Let's examine the tradeoffs through actual ZFS commands:

# RAIDZ-1 creation
zpool create tank raidz1 sda sdb sdc sdd

# Mirror configuration
zpool create tank mirror sda sdb mirror sdc sdd

Key metrics comparison:

Metric RAIDZ-1 Mirror
Usable Capacity 6TB 4TB
Fault Tolerance 1 disk 1 disk per vdev
Rebuild Time Full 6TB read 2TB copy per mirror
Performance Good reads, poor writes Excellent both

The 8GB RAM limitation creates additional constraints. Here's a recommended zpool creation command with optimized settings:

zpool create -o ashift=12 tank \
    -O compression=lz4 \
    -O atime=off \
    -O recordsize=128K \
    mirror sda sdb mirror sdc sdd

Important parameters:

  • ashift=12: Proper alignment for 4K sector drives
  • compression=lz4: Typically achieves 1.5-2x space savings
  • recordsize=128K: Optimizes for large file storage

Consider these failure modes and recovery procedures:

# Failed disk replacement (mirror example)
zpool offline tank sda
# Physically replace drive
zpool replace tank sda /dev/sdx
zpool online tank sda

With RAIDZ-1, recovery becomes more complex:

# RAIDZ-1 resilvering monitoring
zpool status -v tank
zpool scrub tank

When space is critical, consider these ZFS features before choosing RAIDZ-1:

# Enable compression (reversible)
zfs set compression=lz4 tank

# Set quota to prevent over-provisioning
zfs set quota=3.5T tank

# Space-saving snapshot management
zfs snapshot tank@clean
zfs list -t snapshot