SOLVED geli sector size differ from physical and logical sector size

peacepipe

Dabbler
Joined
Dec 17, 2017
Messages
36
Dear community,

I build up today my backup server with 7x SAMSUNG HD203WI (2TB) disks. They have a physical and logical sector size of 512b.

e.g.
Code:
camcontrol identify ada0
pass0: <SAMSUNG HD203WI 1AN10003> ATA8-ACS SATA 2.x device
pass0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)

protocol              ATA8-ACS SATA 2.x
device model          SAMSUNG HD203WI
firmware revision     1AN10003
serial number         S1UYJ1AZ808264
WWN                   50024e9003f128cc
additional product id
cylinders             16383
heads                 16
sectors/track         63
sector size           logical 512, physical 512, offset 0
LBA supported         268435455 sectors
LBA48 supported       3907029168 sectors
PIO supported         PIO4
DMA supported         WDMA2 UDMA6
media RPM             5400
Zoned-Device Commands no
...



I created an encrypted pool by the Freenas-WebGUI. Unfortunately the WebGUI used the wrong sector size "4096" for ashift:
zdb -U /data/zfs/zpool.cache | grep ashift
ashift: 12

The correct ashift should be 9 for 512b.


So I tried to change it via sysctl in /etc/sysctl.conf:
vfs.zfs.min_auto_ashift=9
vfs.zfs.vdev.larger_ashift_minimal=0

After recreating the pool I checked it again:
zdb -U /data/zfs/zpool.cache | grep ashift
ashift: 12

I tried to find the trouble maker. After a time I double checked it with the geli:
geli dump /dev/gptid/faff3127-79a5-11ea-9a87-50e54938d02e
Metadata on /dev/gptid/faff3127-79a5-11ea-9a87-50e54938d02e:
magic: GEOM::ELI
version: 7
flags: 0x0
ealgo: AES-XTS
keylen: 256
provsize: 1998251364352
sectorsize: 4096
keys: 0x01
iterations: -1
...

The FreeNAS-Webgui / geli choose the wrong sector size of the underlaying provider => 4096 instead of 512.

Regarding this post:
"It defaults to reported sector size of the underlying provider, so 512
bytes, I guess. In my opinion 4096 is optimal. Larger sectors are
problematic, because if sector size it is larger than page size various
tools will have problems with mmap(2)ing files." - source: https://lists.freebsd.org/pipermail/freebsd-geom/2011-April/004739.html

I have to switch the geli sector size to 512. How can I do it without a script. Is there any way to configure geli to use my wished sector size of 512 as default?

Anyway, is it strictly recommended to set the ashift to 9 for 512b sector size? Does it have a huge performance impact? I read already that ashift=12 is recommended for future purposes (hdd change). That isn't planned.


Kind regards,
peacepipe
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
ashift=12 is perfectly fine for 512 and 4k per sector disk drives. No need to worry. ashift=9 is very bad for 4k sector disks. So FreeNAS uses the safe default of 12.
 
Top