How to Replace a Failed ZFS Disk in Proxmox

Replacing a failing or dead drive in a ZFS pool is a common task. Here is the safest and most efficient way to swap a disk using the command line.

1. Identify the Failed Disk

First, you need to find the unique ID or the name of the disk that has failed.

zpool status
Code language: Bash (bash)

Look for the disk marked as DEGRADED or OFFLINE. Note its long ID (e.g., ata-ST9750420AS_...).

2. Identify the New Disk

After physically plugging in the new drive, find its ID. Using the serial number ID is safer than using /dev/sdb, as IDs never change.

ls /dev/disk/by-id/
Code language: Bash (bash)

Identify your new drive from the list (it will usually be the one you don’t recognize from the previous zpool status).

3. Prepare the New Disk (Wipe)

Before adding the disk to the pool, ensure it is clean.

  • Proxmox GUI: Go to Node > Disks, select the new drive, and click Wipe Disk.
  • This removes any old partition tables or leftover metadata.

4. Replace the Disk in the Pool

Now, run the replace command. The syntax is:

<code>zpool replace <pool_name> <old_disk_id> <new_disk_id></code>Code language: Bash (bash)

Example with full paths:

zpool replace HDD500 /dev/disk/by-id/ata-ST9750420AS_5WS05B0B /dev/disk/by-id/ata-WDC_WD5000AZLX-60K2TA0_WD-WCC6Z7TN5FP5
Code language: Bash (bash)

Shorter version: ZFS is smart enough to find the paths if you just provide the IDs:

zpool replace HDD500 ata-ST9750420AS_5WS05B0B ata-WDC_WD5000AZLX-60K2TA0_WD-WCC6Z7TN5FP5
Code language: Bash (bash)

5. Monitor the Progress

ZFS will now start “Resilvering” (copying data to the new disk). You can monitor this in real-time:

Bash

zpool status -v 1
Code language: Bash (bash)

Note: Do not remove the old disk physically until you are sure which one it is, and always keep a backup of your data before performing disk operations!


Posted

in

,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.