Force ashift=12

Discussion in 'Solaris, Nexenta, OpenIndiana, and napp-it' started by modder man, Apr 1, 2017.

  1. modder man

    modder man Active Member

    Joined:
    Jan 19, 2015
    Messages:
    621
    Likes Received:
    59
    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
     
    #1
  2. wildchild

    wildchild Active Member

    Joined:
    Feb 4, 2014
    Messages:
    394
    Likes Received:
    56
    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
     
    #2
  3. modder man

    modder man Active Member

    Joined:
    Jan 19, 2015
    Messages:
    621
    Likes Received:
    59
    This is a new build there is no data yet. I am just trying to get the pool built properly.
     
    #3
  4. TheBloke

    TheBloke Active Member

    Joined:
    Feb 23, 2017
    Messages:
    201
    Likes Received:
    39
    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
     
    #4
  5. Danic

    Danic Member

    Joined:
    Feb 6, 2015
    Messages:
    69
    Likes Received:
    26
    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.
     
    #5
    T_Minus likes this.
  6. modder man

    modder man Active Member

    Joined:
    Jan 19, 2015
    Messages:
    621
    Likes Received:
    59
    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
     
    #6
  7. gea

    gea Well-Known Member

    Joined:
    Dec 31, 2010
    Messages:
    1,916
    Likes Received:
    629
    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.
     
    #7
    Last edited: Apr 2, 2017
  8. modder man

    modder man Active Member

    Joined:
    Jan 19, 2015
    Messages:
    621
    Likes Received:
    59
    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.
     
    #8
  9. gea

    gea Well-Known Member

    Joined:
    Dec 31, 2010
    Messages:
    1,916
    Likes Received:
    629
    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.
     
    #9
  10. modder man

    modder man Active Member

    Joined:
    Jan 19, 2015
    Messages:
    621
    Likes Received:
    59
    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?
     
    #10
  11. cperalt1

    cperalt1 Active Member

    Joined:
    Feb 23, 2015
    Messages:
    177
    Likes Received:
    49
    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.
     
    #11
  12. gea

    gea Well-Known Member

    Joined:
    Dec 31, 2010
    Messages:
    1,916
    Likes Received:
    629
    - 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
     
    #12
  13. modder man

    modder man Active Member

    Joined:
    Jan 19, 2015
    Messages:
    621
    Likes Received:
    59
    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?
     
    #13
  14. gea

    gea Well-Known Member

    Joined:
    Dec 31, 2010
    Messages:
    1,916
    Likes Received:
    629
    Quite strange as Open-ZFS should keep basic ZFS properties.
    But I cannot comment as I do not use FreeNas
     
    #14
  15. cperalt1

    cperalt1 Active Member

    Joined:
    Feb 23, 2015
    Messages:
    177
    Likes Received:
    49
    freenode Web IRC (qwebirc)

    Seems like a question to take up at the zfs IRC. I'm sure they would at least be interested in the topic since as gea said it is a basic VDEV property.
     
    #15
  16. modder man

    modder man Active Member

    Joined:
    Jan 19, 2015
    Messages:
    621
    Likes Received:
    59
    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
     
    #16
Similar Threads: Force ashift=12
Forum Title Date
Solaris, Nexenta, OpenIndiana, and napp-it ashift=12 as default Oct 21, 2014
Solaris, Nexenta, OpenIndiana, and napp-it Trouble forcing 4k / ashift=12, need help with SD.conf Jun 30, 2013

Share This Page