gpart add -a 4096 vs 4k

Irjohn Junus i.junus at gmail.com
Thu Jun 14 14:16:43 UTC 2012


Thank you Robert and Steve.

I'm building a ZFS pool (striped mirrors, boot and ZIL on an SSD - perhaps
another SSD for L2ARC but this is later) with consumer grade spindle disks.
Choice was either Seagate's 4K Barracuda 7200.14 or Hitachi's 512B 7K3000,
both 2TB capacity. I decided to go with Hitachi because here where I live
it comes with 3yr warranty vs 2yr for Seagate, although the Hitachis are
20% pricier at current price. Also, I have had good experience with
Hitachi; my 1st generation Apple Time Capsule is still going strong after
so many years (it has a 500GB Hitachi).

The challenge is, I need to future-proof my ZFS pool built on these (last
of high capacity 512B spindle disk?) Hitachis in case I need to replace any
with 4K drive in the near future. Thus all these headaches about raw vs
GPTed, 4K partition alignment, start sector, ashift value etc etc etc while
at the same time balancing read/ write performance.

I did some preliminary tests on a couple of mirrored Hitachis with dd and
bonnie++ and it's interesting that the best read/ write balance at
ashift=12 is to have these Hitachis GPTed and aligned with -a 4k. I'm
attaching a table below for everyone's comment (PNG file, please let me
know if you can't view it).

[image: Inline image 1]



System is Intel DH61WW mainboard with i3-2120 and 16GB 1333MHz DRAM. Boot
SSD is Intel 320 120GB with the mainboard, Hitachis with an IBM M1015
flashed to LSI 9211-8i IT firmware.



Thanks,
Irjohn





On Thu, Jun 14, 2012 at 4:41 AM, Robert Simmons <rsimmons0 at gmail.com> wrote:

> 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.
> _______________________________________________
> freebsd-fs at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"
>


More information about the freebsd-fs mailing list