在Linux上使用ZFS,如何列出设备(vdev)特定属性?
作者:互联网
我现在使用ZFS一段时间没有问题.我仍然对它感到兴奋,我非常信任它.但是我不时会想到新的问题(特别是在阅读了一些文档后,有时会增加问题的数量而不是减少问题).
在这种情况下,我在根池中添加了一个新的vdev(镜像),因此已经阅读了zpool手册(man zpool).在zpool add部分的末尾,它指出:
-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.
这意味着ashift属性不是特定于池的,而是特定于vdev.但我无法找到任何允许我按vdev查看该属性(或任何其他vdev特定属性)的命令或选项.
换句话说,例如,如果我有一个包含一个ashift = 12的vdev和一个ashift = 10的vdev的池,我该如何验证呢?
我已经尝试过的:
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
因此,zpool list和zpool get都不会以特定于vdev的方式显示任何属性.
有任何想法吗?
解决方法:
要查看ashift等特定设置的当前值,您需要使用zdb命令而不是zpool命令.
在没有参数的情况下独立运行zdb将为您提供系统中找到的任何池及其vdev和vdev中的磁盘的视图.
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
或者,对于上下文中的ashift:
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
仍然非常有用的信息来源和意图,以及zdb产生的信息. quick google还揭示了许多可能与Linux上的ZFS更具体相关的帖子.
标签:linux,zfs,devices 来源: https://codeday.me/bug/20190809/1634377.html