1

I have a Debian system installed on zfspool of 4 HDDs (like raid10 - raid0 of two raid1). And was displayed like set of 2 mirrors mirror0 and mirror1 each with 2 HDDs.

One of the disks became Faulted. As there was no more free slots in this server, I detached it by command:

zpool detach poolname diskname

And then unplug it physically, and plug in a new one. Now zpool looks like this:

zpool status rpool
  pool: rpool
 state: ONLINE
  scan: scrub repaired 52K in 0 days 08:33:06 with 0 errors on Sun May  9 08:57:09 2021
config:

        NAME                                        STATE     READ WRITE CKSUM
        rpool                                       ONLINE       0     0     0
          mirror-0                                  ONLINE       0     0     0
            ata-TOSHIBA_HDWQ140_104EK2MQFAYG-part3  ONLINE       0     0     0
            ata-TOSHIBA_HDWQ140_1042K0ECFAYG-part3  ONLINE       0     0     0
          ata-TOSHIBA_HDWQ140_104EK2MLFAYG          ONLINE       0     0     0

Looks like it's not a raid10 anymore. And I can not replace faulted disk with new one:

zpool replace rpool 4504484537486819887 /dev/disk/by-id/newdisk_id
cannot replace 4504484537486819887 with /dev/disk/by-id/newdisk_id: no such device in pool

What is the safe way to add a new disk to pool and restore pool configuration?

Romeo Ninov
  • 5,263
  • 4
  • 20
  • 26
ALexJolno
  • 13
  • 2

1 Answers1

0

As you detach the failed disk, the top level vdev is not a mirror anymore. So you can not replace the old disk. Rather, you need to attach the new one with something similar to:

zpool attach rpool ata-TOSHIBA_HDWQ140_104EK2MLFAYG <newdisk>

As always, before running anything, be sure to have current backups.

shodanshok
  • 47,711
  • 7
  • 111
  • 180
  • answer by shodanshok was absolutely correct - I followed recommendation with exact command and zfs successfully attached disk to pool and started resilvering. Now it looks like it was before detachment (with new disk in mirror 1) Thank you! – ALexJolno Jun 17 '23 at 15:44
  • 1
    If so, feel free to upvote and accept my answer – shodanshok Jun 17 '23 at 17:18
  • Sorry, have no enough reputation yet. I'll return here when earn some. – ALexJolno Jun 19 '23 at 11:51