WD Advanced Format: do I need to do something special?

Kevin Oberman kob6558 at gmail.com
Thu Aug 18 23:11:09 UTC 2011


On Thu, Aug 18, 2011 at 3:10 AM, Marc Fonvieille <blackend at freebsd.org> wrote:
> On Thu, Aug 18, 2011 at 01:47:26AM -0700, Yuri wrote:
>> WD has sectors of the size 4kB in their latest hard drives, which is
>> different from the traditional 512B.
>> http://www.wdc.com/advformat
>> http://wdc.custhelp.com/app/answers/detail/a_id/5655
>>
>> These articles assert that something special should be done in OS to
>> enable high performance of such drives. For ex. WD recommends to install
>> some latest drivers of particular version.
>> But what about FreeBSD? Should it be configured in some special way too
>> for these drive to perform well?
>> Is it aware of 4kB sector size?
>>
>
> I own that (I'm running 8-STABLE):
>
> ada0 at ahcich2 bus 0 scbus2 target 0 lun 0
> ada0: <WDC WD10EARS-00Y5B1 80.00A80> ATA-8 SATA 2.x device
> ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
> ada0: Command Queueing enabled
> ada0: 953869MB (1953525168 512 byte sectors: 16H 63S/T 16383C)
>
> which has 4kB sectors but says "512 byte sectors" :)
>
> I use the whole disk for the FreeBSD slice, I aligned all partitions on
> a multiple of 8 sectors (512*8=4096).
>
> By default fdisk(8) uses a 63 sectors default offset:
>
> ******* Working on device /dev/ada0 *******
> parameters extracted from in-core disklabel are:
> cylinders=1938021 heads=16 sectors/track=63 (1008 blks/cyl)
>
> Figures below won't work with BIOS for partitions not in cyl 1
> parameters to be used for BIOS calculations are:
> cylinders=1938021 heads=16 sectors/track=63 (1008 blks/cyl)
>
> Media sector size is 512
> Warning: BIOS sector numbering starts with sector 1
> Information from DOS bootblock is:
> The data for partition 1 is:
> sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
>    start 63, size 1953525105 (953869 Meg), flag 80 (active)
>        beg: cyl 0/ head 1/ sector 1;
>        end: cyl 1023/ head 15/ sector 63
> The data for partition 2 is:
> <UNUSED>
> The data for partition 3 is:
> <UNUSED>
> The data for partition 4 is:
> <UNUSED>
>
>
> Look at "start 63" statement.  Instead of fixing fdisk(8) behavior, I just
> correctly edited my bsdlabel(8) table:
>
> # /dev/ada0s1:
> 8 partitions:
> #          size     offset    fstype   [fsize bsize bps/cpg]
>  a:    4194304         17    4.2BSD        0     0     0
>  b:    8388608    4194321      swap
>  c: 1953525105          0    unused        0     0     # "raw" part, don't edit
>  d:   16777216   12582929    4.2BSD        0     0     0
>  e: 1924163584   29360145    4.2BSD        0     0     0
>
>
> The important part is the offset 17 to correct the fdisk(8) offset (16+1
> to align the previous 63).  The remaining offsets are calculted from the
> size I gave for the partitions (in MB, which can be divided by 8).
> Then I used newfs(8) with the option "-f 4096".
>
>
> There's another painful issue with this disk: the automatic head-parking
> after few seconds.  I disabled it (with wdidle3) cause after 2 months of
> use, I was at more than 35000 head-parkings...

I'd strongly suggest avoiding fdisk(8) and using gpart(8) on 8 and
above. It has an
alignment option that makes this all just work and also allows the use of GPT
formatting. (Watch out for GPT on any system that needs to run 32-bit Windows.)

gpart create -s gpt ada1
gpart bootcode -b /boot/pmbr ada1
gpart add -t freebsd-boot -a 4 -s 128 -b 40 ad0
gpart bootcode -p /boot/gptboot -i 1 ad0
gpart add -t freebsd-ufs -a 4 -s 2097152 ada1
gpart add -t freebsd-swap -a 4 -s 8388608 ada1
gpart add -t freebsd-ufs -a 4 -s 10485760 ada1
gpart add -t freebsd-ufs -a 4 -s 1048576 ada1
gpart add -t freebsd-ufs -a 4 ada1

This will give you a disk with a 1G root, 4G swap, 5G var, .5G tmp and
the remainder for usr.. You can adjust these as you feel appropriate.
I would suggest a careful reading of the gpart(8) man page, as well,
just so you understand what is going on. You might find the Wikipedia
entry for "GUID Partition Table" intetresting if you want to go the
GPT route.

You can also use gpart create -s mbr to create a traditional MBR
slice/partition setup, There are several on-line articles detailing
this operation.
-- 
R. Kevin Oberman, Network Engineer - Retired
E-mail: kob6558 at gmail.com


More information about the freebsd-stable mailing list