ZFS How are zpool devices determined?

I have been trying to figure this out, why does zpool status displays different disk description on different devices? I have multiple machines in my homelab, and it seems there are multiple presentations for disks depending on the machine. I am specifically referring to what the device is called in zpool status.

So I have three Lenovo m710q Tiny mini-servers, all of which have one SSD and one NVMe drive in a mirrored pair. In addition, I also have a laptop with a mirrored pair of SSDs in it. So the NVMe drives are a separate problem not covered here (sometimes it is called /dev/nvme* and other places it is referred to as /dev/nda*).

So I have the following servers:
Code:
ares (m710q Tiny)
  /dev/ada0 = Crucial CT480BX500SSD1
zpool status:
        NAME          STATE     READ WRITE CKSUM
        NCC1650       ONLINE       0     0     0
          mirror-0    ONLINE       0     0     0
            gpt/zfs0  ONLINE       0     0     0
            nda0p3    ONLINE       0     0     0

artemis (m710q Tiny)
  /dev/ada0 = WDS100T2B0A-00SM50
zpool status:
       NAME          STATE     READ WRITE CKSUM
        NCC1658       ONLINE       0     0     0
          mirror-0    ONLINE       0     0     0
            gpt/zfs0  ONLINE       0     0     0
            nda0p3    ONLINE       0     0     0

danube (Lenovo w520)
  /dev/ada0 = Crucial CT480BX500SSD1
  /dev/ada1 = SanDisk SDSSDA480G
zpool status:
        NAME            STATE     READ WRITE CKSUM
        NX72003         ONLINE       0     0     0
          mirror-0      ONLINE       0     0     0
            ada1p3.eli  ONLINE       0     0     0
            ada0p3.eli  ONLINE       0     0     0

In addition, I have seen other combinations on other platforms, including some where every drives is by gptid/<really long string>, and on my desktop machine, which has two pools, one a mirrored pair of NVMes and the other of spinning rust, I have:
Code:
           nda0p3  ONLINE       0     0     0
           nda1p3  ONLINE       0     0     0
and
           ada2p2  ONLINE       0     0     0
           ada1p2  ONLINE       0     0     0

So my question is, is it possible to manage a setting to control how disk devices are displayed? Especially how it is presented to zpool?

Thanks!
 
If I understand your question, it comes down to what name is used in the zpool command.

Very rough example:
You have a SATA device that shows up at /dev/ada0. You use gpart commands to partition and label the partitions, giving you /dev/ada0p2 with a gpart label of "mystuff". You have sysctls set to enable all the different types of labels (gpart/gpt labels, glabel, diskuid)
The system boots and in the beginning that partition can be referenced by /dev/ada0p2, /dev/gpt/mystuff plus /dev/diskid/something.

Now you want to pull that into zfs vdev, so you do a "zpool attach/add". How you reference that partition is what shows up in the zfs/zpool status commands.
Your first block, you likely gpart labeled a partition as zfs0 and then used gpt/zfs0 in creating the mirror.
The second mirror using the GELI bits, obviously you used the encrypted names.

All the other examples you likely used the raw /dev/adaXpY names when doing the zpool/zfs commands.

For the mirrors, you can use gpart to label the partitions (gpart list to show), then once you figure out what gpart label corresponds to which raw device, you can zpool detach the old name and then gpart attach gpt/whateverthelabelis

sysctls that enable what "disk ids" are available:
kern.geom.label.disk_ident.enable
kern.geom.label.gptid.enable
kern.geom.label.ufsid.enable
 
In general it's whatever you used when creating the pool, although I've occasionally seen the actual ID that ZFS uses when the disk's label doesn't match what ZFS thinks it should be.
 
If I understand your question, it comes down to what name is used in the zpool command.

Very rough example:
You have a SATA device that shows up at /dev/ada0. You use gpart commands to partition and label the partitions, giving you /dev/ada0p2 with a gpart label of "mystuff". You have sysctls set to enable all the different types of labels (gpart/gpt labels, glabel, diskuid)
The system boots and in the beginning that partition can be referenced by /dev/ada0p2, /dev/gpt/mystuff plus /dev/diskid/something.

Now you want to pull that into zfs vdev, so you do a "zpool attach/add". How you reference that partition is what shows up in the zfs/zpool status commands.
Your first block, you likely gpart labeled a partition as zfs0 and then used gpt/zfs0 in creating the mirror.
The second mirror using the GELI bits, obviously you used the encrypted names.

All the other examples you likely used the raw /dev/adaXpY names when doing the zpool/zfs commands.

For the mirrors, you can use gpart to label the partitions (gpart list to show), then once you figure out what gpart label corresponds to which raw device, you can zpool detach the old name and then gpart attach gpt/whateverthelabelis

sysctls that enable what "disk ids" are available:
kern.geom.label.disk_ident.enable
kern.geom.label.gptid.enable
kern.geom.label.ufsid.enable
Thanks, mer ...I think that is what I was looking for. Now that you have explained why it happens, I need to figure out how to control it. :)

In general it's whatever you used when creating the pool, although I've occasionally seen the actual ID that ZFS uses when the disk's label doesn't match what ZFS thinks it should be.
Well, I allowed the FreeBSD installer create the pool, the closest thing I did to manipulate was to name the pool, not anything to do with the VDEVs.
 
To add to that, the different name labels for the same disk isn't related to ZFS at all. Also ZFS doesn't care which one it uses, it finds drives based on the ZFS metadata on the disk, not by their designation.

You can take an entire pool of disks out of a machine, stick it in another, on different controllers, in a random order, and ZFS will still find everything.
 
Yep SirDice is correct (not a surprise); the stuff I was talking about is roughly called "GEOM Withering". ZFS as pointed out will figure things out, the representation in the zpool status command is more for a human.

What I do is apply a label when doing gpart commands, label is usually the serial number that is visible on the device. Then when I bring it into a vdev, I use gpt/mylabel.
Why? So that if I need to replace a device, I just need to look for a serial number.

If you have things in mirrors or redundant configuration, you can:
zpool detach a device in the mirror
gpart label it (say mylabel)
zpool attach gpt/mylabel
let it resilver
then repeat with the other device in the mirror.

You just need to make sure your labels are meaningful to you.
 
What I do is apply a label when doing gpart commands, label is usually the serial number that is visible on the device.
That makes it easier for us mere mortals to identify the exact disk. I like using a slot number as label as it's easier to find the exact disk in a hot swap bay. And yes, I did once pull out the wrong disk in a RAID10 (striped set of mirrors). I intended to remove/replace a broken disk, not pull out the only good one of that mirror set. Good learning experience. Hopefully never doing that again.
 
  • Like
Reactions: mer
Back
Top