1

I tried to expand my two-way mirror to a three-way mirror. The new drive had some filesystem issues (ext4) so I tried to force zpool add -f the drive for ZFS to handle for me. This led to a weird configuration:

 config:
    mypool                ONLINE
      mirror-0            ONLINE
        wwn-drive1-part1  ONLINE
        wwn-drive2-part1  ONLINE
      scsi-new-drive      ONLINE

So I then tried to attach the new drive:

sudo zpool attach -f mypool wwn-drive1-part1 scsi-new-drive 
/dev/disk/by-id/scsi-new-drive is in use and contains a unknown filesystem.

What I then did which further complicated things is export the pool and wipe the drive (wipefs -a). Now of course when I try to import the pool I get:

 config:

    mypool                    UNAVAIL  insufficient replicas
      mirror-0                ONLINE
        wwn-drive1-part1      ONLINE
        wwn-drive1-part1      ONLINE
      scsi-new-drive          UNAVAIL

The existing mirror has two 10TB drives with about 6TB used. I have backups but if possible, I'd like to avoid them and recover (or move?) the pool. I want to get to this state:

    mypool
      mirror-0
        wwn-drive1-part1
        wwn-drive1-part1
        new-drive

Is there any hope? What can I do to restore the pool to operational?

3
  • recover is faster imho due the manipulation
    – djdomi
    Commented Nov 20, 2023 at 5:05
  • which zfs version are you using (you can find it via modinfo zfs | head)?
    – shodanshok
    Commented Nov 20, 2023 at 16:22
  • @shodanshok I am on version 2.1.5-1ubuntu6~22.04.1 however the pool was created with an older version, a few years back.
    – aqua
    Commented Nov 20, 2023 at 16:41

1 Answer 1

2

SHORT ANSWER: restore from backup. If that fails, try the suggestion below. If even that fails, contact a professional recovery service.

LONG ANSWER: you basically added the disk as a top level vdev (stripe member), then wiped some key data (ie: ZFS label) from it and corrupted your pool. Next time, to add a mirror leg (ie: going from 2-ways mirror to a 3-ways mirrors) remember to only use zpool attach without zpool add. When adding a disk by mistake, on recent (>= 2.x) ZFS versions you can issue zpool remove to remove the disk from the pool. Never wipe your disks without first taking the time to to really understand what you are doing.

If you can't restore from backup, try the following:

echo 1 > /sys/module/zfs/parameters/zfs_max_missing_tvds
echo 1 > /sys/module/zfs/parameters/zfs_recover
zpool import -o readonly=on -o failmode=continue mypool

If the pool is correctly imported, you can use a snapshot done before adding the new disk to recover your data. If no such snapshot exists, you can try to read from the "live" filesystem, but be aware that any data written after zfs add will be corrupted (and accessing such data will probably suspend the pool due to IO errors, possibly blocking/crashing the machine).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .