Como criar o espelho ZFS com discos de diferentes tamanhos de setor?

3

Tentando reparar um espelho em um pool do ZFS:

louis@watson:~$ sudo zpool status
  pool: watson
 state: ONLINE
  scan: resilvered 1.55T in 7h22m with 0 errors on Fri Oct  6 03:19:16 2017
config:

NAME                                            STATE     READ WRITE CKSUM
watson                                          ONLINE       0     0     0
  mirror-0                                      ONLINE       0     0     0
    wwn-0x50014ee0ad3655a3                      ONLINE       0     0     0
    ata-Hitachi_HUA723020ALA640_MK0271YGJA5BSA  ONLINE       0     0     0
  wwn-0x50014ee058480994                        ONLINE       0     0     0

Quando tento adicionar um disco, recebo a mensagem " os dispositivos têm um alinhamento de setor diferente ":

louis@watson:~$ sudo zpool attach -f watson wwn-0x50014ee058480994 scsi-SATA_ST2000DM001-1CH_Z1F2ZSLP
cannot attach scsi-SATA_ST2000DM001-1CH_Z1F2ZSLP to wwn-0x50014ee058480994:
devices have different sector alignment

Aqui estão os relatórios setoriais das unidades novas e de destino:

 louis@watson:~$ sudo hdparm -I /dev/disk/by-id/scsi-SATA_ST2000DM001-1CH_Z1F2ZSLP | fgrep Sector
        Logical  Sector size:                   512 bytes
        Physical Sector size:                  4096 bytes
        Logical Sector-0 offset:                  0 bytes
 louis@watson:~$ sudo hdparm -I /dev/disk/by-id/wwn-0x50014ee058480994 | fgrep Sector
        Logical/Physical Sector size:           512 bytes
           *    SCT Long Sector Access (AC1)

Como posso misturar essas unidades em um pool?

    
por Louis 04.11.2017 / 04:11

1 resposta

2

Suponho que se refere a esta verificação (detalhes copiados do usuário DeHackEd ) :

The main purpose is a sort of "force" command for when you have a pool created with ashift=9, then you try to replace/attach a disk with 4k sectors. ZFS doesn't like this (and with good reason) so specifying -o ashift=9 overrides sector size detection and makes ZFS take it.

[...]

No, the requirement is that ashift_of(inserting_disk) <= ashift_of(existing_vdev). Failure to do so will result in EDOM being returned and the operation not proceeding. The inserting_disk value is read from the disk itself, but can be overridden with -o ashift=value with a value satisfying the inequality above to make ZFS accept the disk.

The rationale is that attaching a disk with too big an ashift will result in such staggeringly bad performance (for rotational media anyway) that users will be unhappy. I've done it, my 500G (half filled 1TB drives) mirror took 24 hours to resilver when should have been 2 hours. It was caused by mixing 512 and 4096 byte sector drives.

[...]

Other way around. The pool had ashift=9 but inserting a disk with 4k sectors (ashift=12) results in the inequality 12 <= 9 which is incorrect. Using zpool ... -o ashift=9 makes it 9 <= 9 and ZFS accepts it.

Assim, você pode anexar seu disco usando sudo zpool attach -o ashift=9 -f watson wwn-0x50014ee058480994 scsi-SATA_ST2000DM001-1CH_Z1F2ZSLP , mas seu desempenho pode sofrer. A alternativa seria recriar o pool com discos alinhados corretamente ou não misturar e corresponder tamanhos de setor (o que significa usar discos diferentes).

    
por 06.11.2017 / 09:32