我是 zfs 和设置 KVM 服务器的新手。我了解到为 zpool 设置正确的 ashift 非常重要。我创建了一个包含 4 个 1.92TB Kingston DC600M 驱动器的 zpool,没有设置 ashift。创建后,我不确定这个值设置为多少。这是扇区大小为 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
这是创建的 zpool:
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,它似乎会为每个镜像显示正确的 ahsift 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 ashift 显示为零?
root@kvm1:~# zpool get ashift vm_images
NAME PROPERTY VALUE SOURCE
vm_images ashift 0 default
我现在处于测试模式,正在寻求有关如何将 ashift 设置为 9 来擦除和设置 zpool 的建议?
您
ashift 0
得到的zpool get
只是意味着在设置时 zfs 尝试检测正确的值ashift
(因为没有提供任何值)。如果自动检测失败,则使用默认值 9,这对于磁盘的扇区大小是正确的。来源:
zpool 的联机帮助页
无需擦除 zpool,因为 zdb 会报告正确的值,下次您设置可以使用的池时