Force ashift=12

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

modder man

Active Member
Jan 19, 2015
657
84
28
32
I am working on a new freenas server but notice that my drives Hitachi HUA72303 are using 512b E. Due to this the pool is being created with ashift=9. Since it is highly likely that disks get swapped at some point I am trying to figure out how to force these to use ashift=12 to avoid headache down the road. I even trying creating the pool in napp-it thinking i may have better luck forcing the value there. No matter what i have done i am getting ashift=9.

Thanks
 

wildchild

Active Member
Feb 4, 2014
389
57
28
I believe you cannot change the ashift.
What i had to do is build a new pool and replicate my data to the new pool

Verstuurd vanaf mijn ZP920+ met Tapatalk
 

modder man

Active Member
Jan 19, 2015
657
84
28
32
This is a new build there is no data yet. I am just trying to get the pool built properly.
 

TheBloke

Active Member
Feb 23, 2017
200
40
28
44
Brighton, UK
You're on FreeNAS and so FreeBSD? If so, you can manipulate the ashift at pool creation time using GEOM. I don't know the method as I don't use FreeBSD but there should be plenty of info to be found via a search.

And/or open-zfs.org links to discussion on it - they have a whole section on ashift.

Sent from my Pixel using Tapatalk
 

Danic

Member
Feb 6, 2015
84
35
18
jrdm.us
Try change these sysctl values then recreate pool.

Code:
[root@nas] ~# sysctl -d vfs.zfs.vdev.larger_ashift_minimal vfs.zfs.min_auto_ashift
vfs.zfs.vdev.larger_ashift_minimal: Use ashift=12 as minimal ashift
vfs.zfs.min_auto_ashift: Min ashift used when creating new top-level vdevs.
Code:
sysctl vfs.zfs.vdev.larger_ashift_minimal=1
sysctl vfs.zfs.min_auto_ashift=12

FreeNAS 10 you can set these sysctl values in System -> Tunables -> Add a Tunable -> make sure to select type 'sysctl'
FreeNAS 9 is possible as well but don't have its gui in front of me.
 
  • Like
Reactions: T_Minus

modder man

Active Member
Jan 19, 2015
657
84
28
32
I set those tunable and still end up with a fresh pool that has ashift=9. Little confused as to how that is still the case when it is set to use 12
 

gea

Well-Known Member
Dec 31, 2010
3,141
1,182
113
DE
Ashift is a vdev property that is set during creation and connot be modified on any ZFS platform later beside a re-recreation of the whole pool. As it is basically a disk property Solarish manage this at disk level, see ZFS and Advanced Format disks - illumos - illumos wiki

BSD and ZoL (and a former Illumos zpool version) allow to force at vdev creation time

If I would be able to decide I would propably force ashift=12 always, even when the disks demand ashift=9 as this is the only way to replace old 512b disks with newer 4k disks without problems.
 
Last edited:

modder man

Active Member
Jan 19, 2015
657
84
28
32
gea, that is exactly what I am wanting to do. Every time I have tried I still end up with ashift=9. I have no problems recreating the pool as there is nothing on it yet.
 

gea

Well-Known Member
Dec 31, 2010
3,141
1,182
113
DE
In general, ZFS creates a vdev with ashift=12 automatically
if at least one disk in the vdev is identified as a 4096 physical sector disk.

So the simple solution on is to use at least one 4k disk during vdev creation.
You can replace this one later as the vdev keeps its ashift value.

As ashift is based on a disk property, the Solarish developpers decided
that you can force disk properties like physical sector size in sd.conf.

On BSD and ZoL, there is a more pragmatic way of forcing ashift
on zpool create independently from the physical disk geometry.
 

modder man

Active Member
Jan 19, 2015
657
84
28
32
So let me ask this. What is my risk if I just leave it with 512B sectors and slowly replace with 4k disks as they fail? I have read that you will see performance degradation. Do I have any risk of the array not being able to accept a 4k disk? how big of a performance impact are we talking?
 

cperalt1

Active Member
Feb 23, 2015
180
55
28
43
Another option would be to use an Ubuntu Live CD, install the ZFS Utilities create the pool by forcing ashift=12 then export the pool and import the pool in FreeNAS.
 

gea

Well-Known Member
Dec 31, 2010
3,141
1,182
113
DE
So let me ask this. What is my risk if I just leave it with 512B sectors and slowly replace with 4k disks as they fail? I have read that you will see performance degradation. Do I have any risk of the array not being able to accept a 4k disk? how big of a performance impact are we talking?
- You will propably not be able to replace a 512B disk with a 4k disk when using ashift=9
This will work with ashift=12

A performance degration will occur with 4k disks in 512E emulation mode with ashift=9
With 512B disks in ashift=12/4k mode you may only loose some space
 

modder man

Active Member
Jan 19, 2015
657
84
28
32
I was able to create a pool in Napp-it that shows ashift=12. Once I import the pool to freenas and run "zdb | grep -e ashift" I get a return of ashift=9. What am I missing here?
 

gea

Well-Known Member
Dec 31, 2010
3,141
1,182
113
DE
Quite strange as Open-ZFS should keep basic ZFS properties.
But I cannot comment as I do not use FreeNas
 

modder man

Active Member
Jan 19, 2015
657
84
28
32
Turns out this command "zdb | grep -e ashift" is running on the boot pool not the array I am building. I should have been running zdb -U /data/zfs/zpool.cache | grep -e ashift