You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ZFS存储池ashift值确认及正确设置咨询

ZFS存储池ashift值确认及正确设置咨询

我刚接触ZFS,正在搭建一台KVM服务器,最近了解到给ZFS存储池设置正确的ashift值特别关键。我用4块1.92TB的Kingston DC600M硬盘创建了名为vm_images的存储池,但创建时没手动指定ashift参数,现在不确定它实际被设置成了多少。

先给大家看看我的硬盘扇区信息,fdisk输出显示逻辑/物理扇区都是512字节:

root@kvm1:~# fdisk -l /dev/sda
Disk /dev/sda: 1.75 TiB, 1920383410176 bytes, 3750748848 sectors
Disk model: KINGSTON SEDC600
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 54FF5EA0-CE6E-3145-89A3-234A10DC8AA4

Device          Start        End    Sectors  Size Type
/dev/sda1        2048 3750731775 3750729728  1.7T Solaris /usr & Apple ZFS
/dev/sda9  3750731776 3750748159      16384    8M Solaris reserved 1

这是我创建的存储池状态:

root@kvm1:~# zpool status
  pool: vm_images
 state: ONLINE
config:

        NAME                        STATE     READ WRITE CKSUM
        vm_images                   ONLINE       0     0     0
          mirror-0                  ONLINE       0     0     0
            wwn-0x50026b7686b6cde8  ONLINE       0     0     0
            wwn-0x50026b7686b6cbfb  ONLINE       0     0     0
          mirror-1                  ONLINE       0     0     0
            wwn-0x50026b7686b6ce16  ONLINE       0     0     0
            wwn-0x50026b7686b6ce02  ONLINE       0     0     0

我用zdb -C查看时,发现每个镜像组的ashift值都是9,看起来是正确的:

root@kvm1:~# zdb -C
vm_images:
    version: 5000
    name: 'vm_images'
    state: 0
    txg: 32042
    pool_guid: 18113470955376656359
    errata: 0
    hostid: 940822259
    hostname: 'kvm1'
    com.delphix:has_per_vdev_zaps
    vdev_children: 2
    vdev_tree:
        type: 'root'
        id: 0
        guid: 18113470955376656359
        create_txg: 4
        children[0]:
            type: 'mirror'
            id: 0
            guid: 17129579534474406438
            metaslab_array: 267
            metaslab_shift: 34
            ashift: 9
            asize: 1920368902144
            is_log: 0
            create_txg: 4
            com.delphix:vdev_zap_top: 129
            children[0]:
                type: 'disk'
                id: 0
                guid: 12141588404671866473
                path: '/dev/disk/by-id/wwn-0x50026b7686b6cde8-part1'
                devid: 'scsi-350026b7686b6cde8-part1'
                phys_path: 'pci-0000:1b:00.0-scsi-0:0:13:0'
                whole_disk: 1
                create_txg: 4
                com.delphix:vdev_zap_leaf: 130
            children[1]:
                type: 'disk'
                id: 1
                guid: 4374722492424561155
                path: '/dev/disk/by-id/wwn-0x50026b7686b6cbfb-part1'
                devid: 'scsi-350026b7686b6cbfb-part1'
                phys_path: 'pci-0000:1b:00.0-scsi-0:0:14:0'
                whole_disk: 1
                create_txg: 4
                com.delphix:vdev_zap_leaf: 131
        children[1]:
            type: 'mirror'
            id: 1
            guid: 4063060495541825533
            metaslab_array: 256
            metaslab_shift: 34
            ashift: 9
            asize: 1920368902144
            is_log: 0
            create_txg: 4
            com.delphix:vdev_zap_top: 132
            children[0]:
                type: 'disk'
                id: 0
                guid: 2117188888921191837
                path: '/dev/disk/by-id/wwn-0x50026b7686b6ce16-part1'
                devid: 'scsi-350026b7686b6ce16-part1'
                phys_path: 'pci-0000:1b:00.0-scsi-0:0:17:0'
                whole_disk: 1
                create_txg: 4
                com.delphix:vdev_zap_leaf: 133
            children[1]:
                type: 'disk'
                id: 1
                guid: 14967214633990567153
                path: '/dev/disk/by-id/wwn-0x50026b7686b6ce02-part1'
                devid: 'scsi-350026b7686b6ce02-part1'
                phys_path: 'pci-0000:1b:00.0-scsi-0:0:18:0'
                whole_disk: 1
                create_txg: 4
                com.delphix:vdev_zap_leaf: 134
    features_for_read:
        com.delphix:hole_birth
        com.delphix:embedded_data

但奇怪的是,用zpool get ashift命令查看时,存储池的ashift值显示为0:

root@kvm1:~# zpool get ashift vm_images
NAME       PROPERTY  VALUE   SOURCE
vm_images  ashift    0       default

目前我还在测试阶段,想请教各位大佬:我是否需要销毁当前的存储池,重新手动设置ashift=9来搭建呢?

备注:内容来源于stack exchange,提问作者rwfitzy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 13:14:40