Is default ashift=13 possible?

richardm1

Dabbler
Joined
Oct 31, 2013
Messages
19
I'm experimenting with various settings and tunables in a lab. I cannot get vfs.zfs.min_auto_ashift=13 to survive a reboot in 11.3-U4 no matter what I try -- tunables in the GUI, sysctl at the shell, editing sysctl.conf -- none of them seem to work.

zpool create will yield an ashift=13 pool if I manually set the tunable with sysctl beforehand. So the setting does indeed work. It just refuses to stick. Is this a bug?
 

sworni

Cadet
Joined
Feb 22, 2023
Messages
4
HI,
it would work if 13 is a power of 2.
Tahts the rule for this. The value is a power of two.

Greetings

sworn
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
HI,
it would work if 13 is a power of 2.
Tahts the rule for this. The value is a power of two.

Greetings

sworn

That's not it. Neither ashift=9 nor ashift=12 are powers of 2. Rather, these are the exponents: ashift=9 means 2^9=512 byte sectors; ashift=12 means 2^12=4096 byte sectors.

As no disks I'm aware of have native 2^13=8192 byte sectors, I'm not surprised you're having difficulty getting this to stick. What exactly are you trying to accomplish with ashift=13?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
vfs.zfs.min_auto_ashift=13 to survive a reboot in 11.3-U4 no matter what I try -- tunables in the GUI, sysctl at the shell

The GUI isn't smart enough to filter sysctl values. If you could get it to be set from the CLI, it should also be settable via the GUI if done correctly, and should persist across reboots.

As no disks I'm aware of have native 2^13=8192 byte sectors, I'm not surprised you're having difficulty getting this to stick. What exactly are you trying to accomplish with ashift=13?

The idea behind ashift=13 is to cause flash devices to align with their common default page size. However, page sizes vary, and can be 2K, 4K, 8K, or 16K. Around 2012, Ars Technica had a great SSD primer that claimed (correctly) the most common page size was 8K. There's some value to setting ashift to match the page size because it reduces wear on the flash device, but it turns out that it is difficult to identify the actual page size used inside a device.

 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
That makes sense, @jgreco. If OP's attempting this on a pool with spinners, that would explain why it's not sticking. This would only work on a pool consisting entirely of homogeneous SSDs.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
I'm not aware of any such limitation or interconnection. ashift is a per-pool setting and you can force pool creation using various nonstandard ashift sizes. You can see the workflow in post #6 of the thread I linked; I assure you that it goes to numbers other than 9 or 13 just as easily. ZFS effectively uses it as the "sector size" of the pool. The real problem here is that there isn't good visibility into an SSD's page size so it becomes very difficult to know what an optimal value would be.
 

sworni

Cadet
Joined
Feb 22, 2023
Messages
4
Hi,

I was just curious and tried it on my FreeBSD 12.3-STABLE.
In /etc/sysctl.conf
I put

vfs.zfs.min_auto_ashift=13

(12) is my normal value andrebooted it.
On my bash:
# sysctl vfs.zfs.min_auto_ashift

vfs.zfs.min_auto_ashift: 13

For me it works.

Greetings

sworn
 

sworni

Cadet
Joined
Feb 22, 2023
Messages
4
I'm experimenting with various settings and tunables in a lab. I cannot get vfs.zfs.min_auto_ashift=13 to survive a reboot in 11.3-U4 no matter what I try -- tunables in the GUI, sysctl at the shell, editing sysctl.conf -- none of them seem to work.

zpool create will yield an ashift=13 pool if I manually set the tunable with sysctl beforehand. So the setting does indeed work. It just refuses to stick. Is this a bug?

Hi,
could you please show me the value of

vfs.zfs.max_auto_ashift
I could imagine that vfs.zfs.min_auto_ashift will not stick permanently if it is <= 12.
Mine is 14 and despite reboot 13 in ashift_min: worked just fine.

Greetings

sworn
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
I could imagine that vfs.zfs.min_auto_ashift will not stick permanently if it is <= 12.

You are correct, it will not "stick permanently", but then again, NO sysctl value can "stick permanently". These values have to be set at boot time, which in TrueNAS is done via the Tunables section in the GUI.
 
Top