gpart add -a 4096 vs 4k

Robert Simmons rsimmons0 at gmail.com
Wed Jun 13 20:41:16 UTC 2012


On Wed, Jun 13, 2012 at 10:24 AM, Steven Hartland
<killing at multiplay.co.uk> wrote:
> ----- Original Message ----- 2012/6/13 Irjohn Junus <i.junus at gmail.com>:
>
>> Hello,
>>
>> Relatively new to FreeBSD and learning, I'm trying to partition my HDD and
>> align it to 4k sector.
>>
>> I do apologize if this has been answered before, I have Googled and read
>> gpart(8) man page to no joy. Can anyone please advice why gpart add '-a
>> 4096' doesn't yield the same result with '-a 4k'? Many thanks and captures
>> are below.
>
>
>
> Question: Do you actually want to partition? Or are you just trying
> to get it 4k aligned?
>
> Its my understanding, someone correct me if I'm wrong, that if you
> just want to create a zfs volume on a disk you can just use the raw
> disk instead of a partition slice and alignment just works.
>
> Its only if you want multiple slices and hence need to partition that
> you need to worry about alignment.
>
> Also worth noting that if your 4k disk is actually reporting as 512b
> sectors e.g.
> cat /var/run/dmesg.boot |grep sectors
> da0: 57241MB (117231408 512 byte sectors: 16H 63S/T 16383C)
>
> Then you can use gnop hack to fix this:-
> gnop create -S 4096 da0
> zpool create mytank da0.nop
> zpool export mytank
> gnop destroy da0.nop
> zpool import mytank
>
> This will ensure the value of the zpool ashift is 12 for a 4k disk.
> You can check this with:-
> zdb | grep ashift
>
> In my testing this made 100MB/s performance increase for sequential
> writes of none random data on a Corsair Force 2 60GB ssd.

Keep in mind that when you talk about alignment to 512b or to 4k, you
are talking about HDD.  When you enter the arena of SSD, you will need
to look at the documentation from your manufacturer about what the
proper alignment should be.  It is related to the erase block
boundaries rather than the size of sectors (SSD drives don't have
sectors).  This size also varies from manufacturer to manufacturer
(some can be 1M some 2M).  Some manufacturers try to keep this
information secret too.  OCZ is one of those, and even if you call
their tech support they won't tell you.


More information about the freebsd-fs mailing list