3

Max ZFS codebase for pool: zfs-linux (0.7.5-1ubuntu16.11)

Imagine a pool that grew unexpectedly, by adding larger mirrors in terms of physical disk capacity. Spares went in tow. New mirror, new spare. SAS Enterprise Grade on HBA. Mirror 0 is smaller than 1 and 1 is smaller than 2. Each mirror has an appropriately sized spare.

  pool: glue
 state: ONLINE
  scan: scrub repaired 0B in 27h55m with 0 errors on Mon Jul 12 04:19:14 2021
config:

    NAME                        STATE     READ WRITE CKSUM
    glue                        ONLINE       0     0     0
      mirror-0                  ONLINE       0     0     0
        wwn-0x5000cca2a501f240  ONLINE       0     0     0
        wwn-0x5000cca2975af090  ONLINE       0     0     0
      mirror-1                  ONLINE       0     0     0
        wwn-0x5000cca271340e4c  ONLINE       0     0     0
        wwn-0x5000cca27134c71c  ONLINE       0     0     0
      mirror-2                  ONLINE       0     0     0
        wwn-0x5000cca2972cce94  ONLINE       0     0     0
        wwn-0x5000cca298192df4  ONLINE       0     0     0
    spares
      wwn-0x5000cca2558480fc    AVAIL   
      wwn-0x5000cca2972be67c    AVAIL   
      wwn-0x5000c50083bbae43    AVAIL   

errors: No known data errors

That's what it might look like. If automatic spares use autoreplace and a small spare tries mirror a disk that is larger than it, will the pool break, or is there an error we can scan for?

Or will autoreplace do checks to make sure spares join mirrors of the same or smaller size? In that case, is it possible for the largest spare to join the smallest mirror?

I'd be happy to take a look at the code if you can point me. Even more, I would love to give you an upvote and a check.

Louis Waweru
  • 695
  • 9
  • 26
  • 1
    OT, but FWIW having a dedicated spare for a mirror isn't IMO optimal. You'd be better off just making a three-way mirror so if a disk fails the data is already on the disk and you don't have to rely on there being no errors on the one remaining disk showing up before you get all the data copied. – Andrew Henle Jul 19 '21 at 19:58
  • @AndrewHenle Right, thank you, Andrew. That is true especially in this care where the mirrors vary in size. Normally all mirrors would be the same size, and not having one spare per mirror would be acceptable. – Louis Waweru Aug 22 '21 at 20:19

1 Answers1

2

Autoreplace is for replacing drives in thesame physical location, it has nothing to do with hot/cold spares.

But it looks like zfs tries all spares in order until it hits one that succeeds. I think this is the relevant source code : GitHub

user189695
  • 89
  • 5
  • Thank you for correcting me, is the correct terminology ‘hotspare’? Thank you tor finding the code by the way. These guys should be paid for their work. – Louis Waweru Jul 15 '21 at 13:10
  • This is a reference to code CB. Do you follow? I read it it unaware, favors manual for soph. – Louis Waweru Jul 15 '21 at 13:10