7

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?

7

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.

  • 1
    Now that is what I am calling an answer. zdb doesn't seem to be mentioned on one of Sun's pages which usually turn up if you google for "ZFS <something>". Before switching to ZFS, I have put an incredible lot of time into researching if it is the right thing for me, and how I could install and configure it, but I have never stumbled across zdb; furthermore, neither man zpool nor man zfs have any hint to it, including the "SEE ALSO" section. Thanks a lot! – Binarus Mar 28 '17 at 17:53
  • 1
    That's an interesting observation. I worked at Sun when ZFS was released, and later for other companies that did a lot of work with ZFS, so zdb seems kind of natural to me. I didn't realize it was black magic at this point. :) Open-ZFS is a consortium of IllumOS/OmniOS/OpenSolaris/FreeBSD/Linux/ an other developers who are trying to make sure the whole non-Oracle ZFS world stays closely aligned. Their Wiki is pretty good and has a lot of information, including some references to zdb, See: open-zfs.org/w/… – Tim Kennedy Mar 28 '17 at 20:56
  • 1
    ZFS on Linux has ZFS man pages which are quite good. As far as I could see, they are the same as the Solaris ones, minus the Solaris specialties. And guess what: On my Linux systems, man zdb does what you would expect :-) So it is documented somehow, but since it is mentioned nearly nowhere, nobody comes to the idea to type man zdb. From the blog post you linked: "[...] but it is, somewhat intentionally I think, undocumented. Only two others that I know have had the courage to talk about it publicly [...]" :-) – Binarus Mar 29 '17 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.