how does TrueNas selects ashift/sector size?

fahadshery

Contributor
Joined
Sep 29, 2017
Messages
179
Hi,

Here is an example output of smartctl for my SSDs and the HDD
Code:
smartctl --xall /dev/da10
smartctl 7.2 2021-09-14 r5236 [FreeBSD 13.1-RELEASE amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               SEAGATE
Product:              ST800FM0053
Revision:             XGEC
Compliance:           SPC-4
User Capacity:        800,166,076,416 bytes [800 GB]
Logical block size:   512 bytes
Physical block size:  4096 bytes
LB provisioning type: not reported [LBPME=1, LBPRZ=0]
Rotation Rate:        Solid State Device
Form Factor:          2.5 inches
Logical Unit id:      0x5000c50030135897
Serial number:        Z3G014RB0000Z3G014RB
Device type:          disk
Transport protocol:   SAS (SPL-3)
Local Time is:        Thu Dec  8 16:58:43 2022 GMT
SMART support is:     Available - device has SMART capability.
SMART support is:     Enabled
Temperature Warning:  Enabled
Read Cache is:        Enabled
Writeback Cache is:   Enabled


Code:
smartctl --xall /dev/da2
smartctl 7.2 2021-09-14 r5236 [FreeBSD 13.1-RELEASE amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               HGST
Product:              HUC101818CS4205
Revision:             NE05
Compliance:           SPC-4
User Capacity:        1,800,360,124,416 bytes [1.80 TB]
Logical block size:   512 bytes
Physical block size:  4096 bytes
Formatted with type 2 protection
8 bytes of protection information per logical block
LU is fully provisioned
Rotation Rate:        10520 rpm
Form Factor:          2.5 inches
Logical Unit id:      0x5000cca02c655e70
Serial number:        08HTS73A
Device type:          disk
Transport protocol:   SAS (SPL-3)
Local Time is:        Thu Dec  8 16:59:37 2022 GMT
SMART support is:     Available - device has SMART capability.
SMART support is:     Enabled
Temperature Warning:  Enabled
Read Cache is:        Enabled
Writeback Cache is:   Disabled


Clearly the physical block size is 4K but TrueNas created the logical block size of 512 bytes? Is that a problem? I thought both should be match???

Here is diskinfo output:

Code:
diskinfo -v /dev/da10
/dev/da10
        512             # sectorsize
        800166076416    # mediasize in bytes (745G)
        1562824368      # mediasize in sectors
        4096            # stripesize
        0               # stripeoffset
        97281           # Cylinders according to firmware.
        255             # Heads according to firmware.
        63              # Sectors according to firmware.
        SEAGATE ST800FM0053     # Disk descr.
        Z3G014RB0000Z3G014RB    # Disk ident.
        mpr1            # Attachment
        Yes             # TRIM/UNMAP support
        0               # Rotation rate in RPM
        Not_Zoned       # Zone Mode

root@truenas[/mnt/ssd_fast10/postgres]# diskinfo -v /dev/da2
/dev/da2
        512             # sectorsize
        1800360124416   # mediasize in bytes (1.6T)
        3516328368      # mediasize in sectors
        4096            # stripesize
        0               # stripeoffset
        218881          # Cylinders according to firmware.
        255             # Heads according to firmware.
        63              # Sectors according to firmware.
        HGST HUC101818CS4205    # Disk descr.
        08HTS73A        # Disk ident.
        mpr0            # Attachment
        No              # TRIM/UNMAP support
        10520           # Rotation rate in RPM
        Not_Zoned       # Zone Mode


the diskinfo is showing the sector size to be 512 and My drives are of 4K? Am I doing it wrong?
I created the pools via GUI so I didn't mentioned any value of ashift=12.
 

artlessknave

Wizard
Joined
Oct 29, 2016
Messages
1,506
pools created since about 2015 are always ashift12. if your pool was ashift9, I believe 4k drives would not work, or work extremely poorly.
ZFS will manage the drives and 4k/512e will be basically invisible. it will write the 4k drives in 4k sectors, it will also try to write 512e drives with 4k sectors also in 4k chucks since it knows that that is the best performance.
unless you are seeing horrid performance, or weird errors, and anything, you can pretty much ignore it.

there is a command to get the ashift. i dont remember exactly, but something like
Code:
zpool get properties ashift
 

MisterE2002

Patron
Joined
Sep 5, 2015
Messages
211
Code:
root@truenas[/var/log]# zpool get ashift tank
NAME  PROPERTY  VALUE   SOURCE
tank  ashift    12      local
 

artlessknave

Wizard
Joined
Oct 29, 2016
Messages
1,506
you should be good then, nothing to do but use pool as desired. ZFS is intended to deal with the underlying disks for you.
the biggest issues came from when ashift defaulted to 9, which, irrc, resulted in absolutely horrendous performance if a 4kn drive was added to the pool.
 
Top