Linux – With ZFS on Linux, how to list device (vdev) specific properties

deviceslinuxzfs

I am using ZFS since a while now without problems. I am still excited about it, and I highly trust it. But from time to time, new questions come to my mind (in particular after having read some documentation, which sometimes increases the number of questions instead of reducing it).

In this case, I have added a new vdev (a mirror) to a root pool, and therefore have read the zpool manual (man zpool). At the end of the section zpool add, it states:

-o property=value

Sets the given pool properties. See the "Properties" section for a
list of valid properties that can be set. The only property supported
at the moment is ashift. Do note that some properties (among them
ashift) are not inherited from a previous vdev. They are vdev
specific, not pool specific.

That means that the ashift property is not pool specific, but vdev specific. But I have not been able to find any command or option which would allow me to view that property (or any other vdev specific property) per vdev.

In other words, for example, if I have a pool which contains one vdev with ashift=12 and one vdev with ashift=10, how can I verify this?

What I have already tried:

root@cerberus:~# zpool list -v -o ashift rpool
ASHIFT
12
  mirror   928G   583G   345G         -    27%    62%
    ata-ST31000524NS_9WK21HDM      -      -      -         -      -      -
    ata-ST31000524NS_9WK21L15      -      -      -         -      -      -
  mirror   928G  74.4M   928G         -     0%     0%
    ata-ST31000524NS_9WK21FXE      -      -      -         -      -      -
    ata-ST31000524NS_9WK21KC1      -      -      -         -      -      -

root@cerberus:~# zpool get all rpool
NAME   PROPERTY                    VALUE                       SOURCE
rpool  size                        1.81T                       -
rpool  capacity                    31%                         -
rpool  altroot                     -                           default
rpool  health                      ONLINE                      -
rpool  guid                        3899811533678330272         default
rpool  version                     -                           default
rpool  bootfs                      rpool/stretch               local
rpool  delegation                  on                          default
rpool  autoreplace                 off                         default
rpool  cachefile                   -                           default
rpool  failmode                    wait                        default
rpool  listsnapshots               off                         default
rpool  autoexpand                  off                         default
rpool  dedupditto                  0                           default
rpool  dedupratio                  1.00x                       -
rpool  free                        1.24T                       -
rpool  allocated                   583G                        -
rpool  readonly                    off                         -
rpool  ashift                      12                          local
rpool  comment                     -                           default
rpool  expandsize                  -                           -
rpool  freeing                     0                           default
rpool  fragmentation               13%                         -
rpool  leaked                      0                           default
rpool  feature@async_destroy       enabled                     local
rpool  feature@empty_bpobj         active                      local
rpool  feature@lz4_compress        active                      local
rpool  feature@spacemap_histogram  active                      local
rpool  feature@enabled_txg         active                      local
rpool  feature@hole_birth          active                      local
rpool  feature@extensible_dataset  enabled                     local
rpool  feature@embedded_data       active                      local
rpool  feature@bookmarks           enabled                     local
rpool  feature@filesystem_limits   enabled                     local
rpool  feature@large_blocks        enabled                     local

So neither zpool list nor zpool get show any property in a vdev specific manner.

Any ideas?

Best Answer

In order to view the current value of a specific setting like ashift, you will need to use the zdb command instead of the zpool command.

Running zdb on its own with no arguments will give you a view of any pools found on the system, and their vdevs, and disks within the vdevs.

root@pve1:/home/tim# zdb
pm1:
    version: 5000
    name: 'pm1'
    state: 0
    txg: 801772
    pool_guid: 13783858310243843123
    errata: 0
    hostid: 2831164162
    hostname: 'pve1'
    vdev_children: 1
    vdev_tree:
        type: 'root'
        id: 0
        guid: 13783858310243843123
        children[0]:
            type: 'raidz'
            id: 0
            guid: 13677153442601001142
            nparity: 2
            metaslab_array: 34
            metaslab_shift: 33
            ashift: 9
            asize: 1600296845312
            is_log: 0
            create_txg: 4
            children[0]:
                type: 'disk'
                id: 0
                guid: 4356695485691064080
                path: '/dev/disk/by-id/ata-DENRSTE251M45-0400.C_A181B011241000542-part1'
                whole_disk: 1
                not_present: 1
                DTL: 64
                create_txg: 4
            children[1]:
                type: 'disk'
                id: 1
                guid: 14648277375932894482
                path: '/dev/disk/by-id/ata-DENRSTE251M45-0400.C_A181B011241000521-part1'
                whole_disk: 1
                DTL: 82
                create_txg: 4
            children[2]:
                type: 'disk'
                id: 2
                guid: 11362800770521042303
                path: '/dev/disk/by-id/ata-DENRSTE251M45-0400.C_A181B011241000080-part1'
                whole_disk: 1
                DTL: 59
                create_txg: 4
            children[3]:
                type: 'disk'
                id: 3
                guid: 10494331395233532833
                path: '/dev/disk/by-id/ata-DENRSTE251M45-0400.C_A181B011241000517-part1'
                whole_disk: 1
                DTL: 58
                create_txg: 4
    features_for_read:
        com.delphix:hole_birth
        com.delphix:embedded_data

or, for just ashift with some context:

root@pve1:/home/tim#  sudo zdb | egrep 'ashift|vdev|type' | grep -v disk
    vdev_children: 1
    vdev_tree:
        type: 'root'
            type: 'raidz'
            ashift: 9

Here is an old blog post about zdb that is still very informative about the origins and intent, and the information that comes out of zdb. A quick google also reveals many posts that may be more specifically relevant to ZFS on Linux.

Related Question