Score:3

Are ZFS Automatic Spares Size-Aware when Using "autoreplace=on"?

cn flag

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.

Andrew Henle avatar
ph flag
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.
cn flag
@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.
Score:2
tn flag

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

cn flag
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.
cn flag
This is a reference to code CB. Do you follow? I read it it unaware, favors manual for soph.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.