How to Replace a Failed Disk in ZFS Pool on FreeNAS: GPTID vs Device Name Resolution and Step-by-Step Replacement Procedure


2 views

The current situation shows two pools with different statuses:


pool: raid-5x3 (ONLINE)
pool: raid2 (DEGRADED with ada2 UNAVAIL)

The key issue is that gptid/5fe33556-3ff2-11e2-9437-f46d049aaeca (ada2) has failed in the raid2 pool. Let's break down the components:

FreeNAS uses different naming conventions:

  • GPTIDs (Globally Unique Identifiers) for disks with GPT partitions
  • Direct device names (adaX) for disks with legacy partitioning

From glabel status and camcontrol devlist correlation:


gptid/5f3c0517-3ff2-11e2-9437-f46d049aaeca → ada1p2
gptid/60570005-3ff2-11e2-9437-f46d049aaeca → ada3p2
gptid/60ebeaa5-3ff2-11e2-9437-f46d049aaeca → ada4p2

Here's how to replace the failed ada2 with spare ada0:


# First prepare the replacement disk
gpart create -s gpt ada0
gpart add -t freebsd-zfs -a 4k ada0

# Get the new GPTID
glabel status | grep ada0p2

# Replace the failed device (using either method)
zpool replace raid2 gptid/5fe33556-3ff2-11e2-9437-f46d049aaeca ada0p2
# OR using GPTID (recommended)
zpool replace raid2 gptid/5fe33556-3ff2-11e2-9437-f46d049aaeca gptid/[new-gptid]

Disks might be missing from glabel status because:

  • They don't have GPT partitions (using legacy MBR)
  • The filesystem wasn't properly labeled during creation
  • The disk wasn't properly initialized in FreeNAS
  1. Always use GPTIDs in production for persistent identification
  2. Monitor resilvering progress with zpool status -v
  3. Consider setting autoreplace=on for hot-swap environments

# Example of setting autoreplace
zpool set autoreplace=on raid2

If the replacement fails:


# Force offline if needed
zpool offline raid2 gptid/5fe33556-3ff2-11e2-9437-f46d049aaeca

# Clear errors before retry
zpool clear raid2

# Verify disk health
smartctl -a /dev/ada0

From your zpool status output, we can see two pools:

pool: raid-5x3 (healthy)
pool: raid2 (degraded due to ada2 failure)

The degraded pool shows one unavailable device with GPTID gptid/5fe33556-3ff2-11e2-9437-f46d049aaeca, which corresponds to ada2p2 based on the device mapping.

The difference between GPTID and ada names appears because:

1. GPTIDs appear when disks were added through FreeNAS GUI
2. Direct ada names appear when disks were added via CLI
3. Some disks may not appear in glabel status if:
   - They aren't partitioned with GPT
   - They don't contain ZFS pools
   - They're raw disks without filesystems

Since you have ada0 available as a spare, here's the complete replacement procedure:

# First, prepare the new disk (ada0)
gpart create -s gpt /dev/ada0
gpart add -t freebsd-zfs -a 4k /dev/ada0

# Find the exact device to replace
zpool status raid2 | grep UNAVAIL
# Returns: gptid/5fe33556-3ff2-11e2-9437-f46d049aaeca

# Execute the replacement
zpool replace raid2 gptid/5fe33556-3ff2-11e2-9437-f46d049aaeca ada0p2

# Monitor the resilvering progress
zpool status -v raid2

If you prefer working with physical device names:

# Find the physical device mapping
glabel status | grep 5fe33556-3ff2-11e2-9437-f46d049aaeca
# (Should show ada2p2 if the disk was still accessible)

# Then replace using:
zpool replace raid2 ada2p2 ada0p2
  • Ensure ada0 has similar or larger capacity than the failed disk
  • Resilvering will begin immediately after replacement command
  • Monitor with zpool status until completion
  • For permanent solution, physically replace ada2 when possible

After resilvering completes:

zpool clear raid2
zpool scrub raid2
zpool status raid2

The pool should return to ONLINE state with all devices healthy.