237fe Harddrive sector size - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > System Hardware

System Hardware Internal storage, motherboards, PCI cards, stuff inside the case.

Reply
 
Thread Tools Display Modes
  #1  
Old December 22nd, 2009, 23:01
tty23 tty23 is offline
Junior Member
 
Join Date: Dec 2009
Posts: 51
Thanks: 7
Thanked 0 Times in 0 Posts
Default Harddrive sector size

Hi,

I just bought 4 Western Digital Caviar Green WD10EARS, which uses 4k sectors:
http://www.wdc.com/wdproducts/librar...579-771430.pdf

However, diskinfo reports 512byte sectors. I hoped FreeBSD would figure out the sector size stuff. Is there any way to correct this? I am using the disks in a ZFS raidz.

Code:
diskinfo -c ad12
ad12
	512         	# sectorsize
	1000204886016	# mediasize in bytes (932G)
	1953525168  	# mediasize in sectors
	1938021     	# Cylinders according to firmware.
	16          	# Heads according to firmware.
	63          	# Sectors according to firmware.

Last edited by DutchDaemon; December 23rd, 2009 at 00:00.
Reply With Quote
  #2  
Old December 23rd, 2009, 01:11
mav@ mav@ is offline
FreeBSD Developer
 
Join Date: Feb 2008
Location: Dnepropetrovsk, Ukraine
Posts: 557
Thanks: 0
Thanked 139 Times in 120 Posts
Default

New ada disk driver and `camcontrol identify` on 8-STABLE should support such cases, but this wasn't tested yet, so feedback welcome.
Reply With Quote
The Following User Says Thank You to mav@ For This Useful Post:
tty23 (December 23rd, 2009)
  #3  
Old December 23rd, 2009, 01:43
tty23 tty23 is offline
Junior Member
 
Join Date: Dec 2009
Posts: 51
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Thanks for the quick reply, I will try that.
Well if I master the kernel compilation stuff
Reply With Quote
  #4  
Old December 23rd, 2009, 03:00
tty23 tty23 is offline
Junior Member
 
Join Date: Dec 2009
Posts: 51
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Hi,

I ran camcontrol identify on the drive, but I cannot see any useful information
in the output. Also in the man pages, I did not find anything to resolve the problem.
Now I am a newbie when it comes to harddrive details, do I miss something?

Diskinfo still reports a 512byte sector size with the new ahci driver.

Code:
pass0: <WDC WD10EARS-00Y5B1 80.00A80> ATA/ATAPI-8 SATA 2.x device

protocol              ATA/ATAPI-8 SATA 2.x
device model          WDC WD10EARS-00Y5B1
firmware revision     80.00A80
cylinders             16383
heads                 16
sectors/track         63
LBA supported         268435455 sectors
LBA48 supported       1953525168 sectors
PIO supported         PIO4
DMA supported         WDMA2 UDMA6 
overlap not supported

Feature                      Support  Enable    Value           Vendor
write cache                    yes      yes
read ahead                     yes      yes
Native Command Queuing (NCQ)   yes              31/0x1F
Tagged Command Queuing (TCQ)   no       no      31/0x1F
SMART                          yes      yes
microcode download             yes      yes
security                       yes      no
power management               yes      yes
advanced power management      no       no      0/0x00
automatic acoustic management  yes      no      254/0xFE        128/0x80
Reply With Quote
  #5  
Old December 23rd, 2009, 21:26
mav@ mav@ is offline
FreeBSD Developer
 
Join Date: Feb 2008
Location: Dnepropetrovsk, Ukraine
Posts: 557
Thanks: 0
Thanked 139 Times in 120 Posts
Default

There should be line like:
sector size logical 512, physical 4096, offset 0
Probably it was added after you updated sources last time.

But I think disk will still report logical sector size of 512 bytes to keep compatibility with legacy software. The only effect you may get now is that ada driver report physical sector size to GEOM via existing mechanism, allowing upper layers to use it somehow. I have no idea whether ZFS able to use that info. UFS and usual disk partitioning tools doesn't yet. Probably with appearance of such devices, work in this area should activate.
Reply With Quote
  #6  
Old December 24th, 2009, 23:43
mav@ mav@ is offline
FreeBSD Developer
 
Join Date: Feb 2008
Location: Dnepropetrovsk, Ukraine
Posts: 557
Thanks: 0
Thanked 139 Times in 120 Posts
Default

I've just implemented in HEAD some missing parts of the stripe info path from disk via GEOM RAIDs to user-level. Now diskinfo able to report stripe size and offset for any device and partition. I'll merge it later.

Now all questions left to partitioning tools and FS maintainers to make this info used without user interference. It should be easy to implement automatic partitions alignment.
Reply With Quote
  #7  
Old December 27th, 2009, 19:05
tty23 tty23 is offline
Junior Member
 
Join Date: Dec 2009
Posts: 51
Thanks: 7
Thanked 0 Times in 0 Posts
Default

I just installed FREEBSD-8 STABLE and ran camcontrol identify ada0,
it reports 512byte sectors instead of 4k. Maybe this is some kind of
compatibility feature of the drive? Or do I need to install CURRENT?

Code:
pass0: <WDC WD10EARS-00Y5B1 80.00A80> ATA-8 SATA 2.x device
pass0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO size 8192bytes)

protocol              ATA/ATAPI-8 SATA 2.x
device model          WDC WD10EARS-00Y5B1
firmware revision     80.00A80
cylinders             16383
heads                 16
sectors/track         63
sector size           logical 512, physical 512, offset 0
LBA supported         268435455 sectors
LBA48 supported       1953525168 sectors
PIO supported         PIO4
DMA supported         WDMA2 UDMA6 
overlap not supported

Feature                      Support  Enable    Value           Vendor
read ahead                     yes	yes
write cache                    yes	yes
flush cache                    yes	yes
Native Command Queuing (NCQ)   yes		31/0x1F
Tagged Command Queuing (TCQ)   no	no	31/0x1F
SMART                          yes	yes
microcode download             yes	yes
security                       yes	no
power management               yes	yes
advanced power management      no	no	0/0x00
automatic acoustic management  yes	no	254/0xFE	128/0x80
media status notification      no	no
power-up in Standby            yes	no
write-read-verify              no	no	0/0x0
unload                         no	no
free-fall                      no	no

Last edited by DutchDaemon; December 27th, 2009 at 19:12.
Reply With Quote
  #8  
Old December 27th, 2009, 19:14
tty23 tty23 is offline
Junior Member
 
Join Date: Dec 2009
Posts: 51
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Sorry, I just saw that I missed your part on the compatibility stuff. So I will just use the disk as it is and wait for the next release

Is there anything I can do to help you (the FreeBSD developers) on this issue?
Reply With Quote
  #9  
Old December 29th, 2009, 08:58
mav@ mav@ is offline
FreeBSD Developer
 
Join Date: Feb 2008
Location: Dnepropetrovsk, Ukraine
Posts: 557
Thanks: 0
Thanked 139 Times in 120 Posts
Default

Try to apply such a patch to camcontrol to get raw identify information from the drive:
Code:
--- camcontrol.c.prev   2009-11-26 11:44:11.000000000 +0200
+++ camcontrol.c        2009-12-26 23:37:42.000000000 +0200
@@ -1348,6 +1350,13 @@ ataidentify(struct cam_device *device, i
        ata_bpack(ident_buf->media_serial, ident_buf->media_serial,
            sizeof(ident_buf->media_serial));
 
+       for (i = 0; i < sizeof(struct ata_params) / 2; i++) {
+               if ((i % 10) == 0)
+                   fprintf(stdout, "\n%3d: ", i);
+               fprintf(stdout, "%04x ", (uint16_t)ptr[i]);
+       }
+       fprintf(stdout, "\n");
+
        fprintf(stdout, "%s%d: ", device->device_name,
                device->dev_unit_num);
        ata_print_ident(ident_buf);
Reply With Quote
  #10  
Old January 1st, 2010, 13:17
tty23 tty23 is offline
Junior Member
 
Join Date: Dec 2009
Posts: 51
Thanks: 7
Thanked 0 Times in 0 Posts
Default

I added the lines manually, I hop I did it right.

# camcontrol identify ada1


Code:
 0: 427a 3fff c837 0010 0000 0000 003f 0000 0000 0000 
 10: 4457 572d 4143 3556 3235 3632 3338 0034 0000 0000 
 20: 0000 0000 0032 3038 302e 4130 3038 4457 2043 4457 
 30: 3031 4145 5352 302d 5930 4235 0031 0000 0000 0000 
 40: 0000 0000 0000 0000 0000 0000 0000 8010 0000 2f00 
 50: 4001 0000 0000 0007 3fff 0010 003f fc10 00fb 0110 
 60: ffff 0fff 0000 0007 0003 0078 0078 0078 0078 0000 
 70: 0000 0000 0000 0000 0000 001f 1706 0000 0044 0040 
 80: 01fe 0000 746b 7f61 4123 7469 bc41 4123 407f 0066 
 90: 0066 0000 fffe 0000 80fe 0000 0000 0000 0000 0000 
100: 6db0 7470 0000 0000 0000 0000 0000 0000 5001 4ee2 
110: 5913 e513 0000 0000 0000 0000 0000 0000 0000 4018 
120: 4018 0000 0000 0000 0000 0000 0000 0000 0029 0000 
130: 0000 0000 0000 16ce 0000 0000 0000 0000 0000 0000 
140: 0000 0000 0004 0000 0000 0000 0000 0000 0000 0000 
150: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 
160: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 
170: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 
180: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 
190: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 
200: 0000 0000 0000 0000 0000 0000 3031 0000 0000 0000 
210: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 
220: 0000 0000 101e 0000 0000 0000 0000 0000 0000 0000 
230: 0000 0000 0000 0000 0001 1000 0000 0000 0000 0000 
240: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 
250: 0000 0000 0000 0000 0000 a4a5 
pass1: <WDC WD10EARS-00Y5B1 80.00A80> ATA-8 SATA 2.x device
pass1: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO size 8192bytes)

protocol              ATA/ATAPI-8 SATA 2.x
device model          WDC WD10EARS-00Y5B1
firmware revision     80.00A80
cylinders             16383
heads                 16
sectors/track         63
sector size           logical 512, physical 512, offset 0
LBA supported         268435455 sectors
LBA48 supported       1953525168 sectors
PIO supported         PIO4
DMA supported         WDMA2 UDMA6 
overlap not supported

Feature                      Support  Enable    Value           Vendor
read ahead                     yes	yes
write cache                    yes	yes
flush cache                    yes	yes
Native Command Queuing (NCQ)   yes		31/0x1F
Tagged Command Queuing (TCQ)   no	no	31/0x1F
SMART                          yes	yes
microcode download             yes	yes
security                       yes	no
power management               yes	yes
advanced power management      no	no	0/0x00
automatic acoustic management  yes	no	254/0xFE	128/0x80
media status notification      no	no
power-up in Standby            yes	no
write-read-verify              no	no	0/0x0
unload                         no	no
free-fall                      no	no
Reply With Quote
  #11  
Old January 3rd, 2010, 18:36
mav@ mav@ is offline
FreeBSD Developer
 
Join Date: Feb 2008
Location: Dnepropetrovsk, Ukraine
Posts: 557
Thanks: 0
Thanked 139 Times in 120 Posts
Default

There should be some jumper on the drive, controlling it's behavior. Haven't you tried to move it?
Reply With Quote
  #12  
Old January 4th, 2010, 16:46
tty23 tty23 is offline
Junior Member
 
Join Date: Dec 2009
Posts: 51
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Yes, there are some jumpers on the drive, but unfortunately there is no
documentation on what they do (except for one, who should be set for
WindowsXP compatibility).
Reply With Quote
  #13  
Old January 4th, 2010, 17:15
tty23 tty23 is offline
Junior Member
 
Join Date: Dec 2009
Posts: 51
Thanks: 7
Thanked 0 Times in 0 Posts
Default

I just googled around a bit, and it seems (as you said), that the drives do not announce the 4k sectors to the OS.
I now opened a support request at WDC. Hopefully they will give some information on the jumper settings.

Last edited by tty23; January 4th, 2010 at 21:47.
Reply With Quote
  #14  
Old January 4th, 2010, 19:58
zapher zapher is offline
Junior Member
 
Join Date: Jan 2010
Location: Gothenburg, Sweden
Posts: 19
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I don't know if I'm missing the point. But the pdf you posted says:
Quote:
Many disk drive interface technologies already allow for increased sector sizes. However, the 512-byte sector has been the standard for over 30 years. As a result, many points in a computer system (systems like personal computers, servers, DVRs, PSPs, and cell phones) have become inflexible and only work using 512-byte sectors. To maintain compatibility with these devices, Advanced Format media emulates a 512-byte device by maintaining a 512-byte sector at the drive interface.
My interpretation is that the 4KB is not something the system has to deal with. It's an internal drive geometry. And by "tricking" the system it's 512B-sectors allows for longer ECC and less padding between sectors. Ergo - more bytes per space.

As I said, I'm sorry if I missed the point entirely. And I can see why the question on how to change sector size is still valid, although these drives seem to overcome the issue.
Reply With Quote
  #15  
Old January 4th, 2010, 21:50
tty23 tty23 is offline
Junior Member
 
Join Date: Dec 2009
Posts: 51
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Yes, I think you are right zapher, it seems that with this thread, I missed the point entirely

However, I asked at WDC if it is possible to announce the 4KB sector size to the OS by a jumper setting. So hopefully, this was not all in vain.
Reply With Quote
  #16  
Old January 4th, 2010, 22:17
zapher zapher is offline
Junior Member
 
Join Date: Jan 2010
Location: Gothenburg, Sweden
Posts: 19
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Discussion is almost never in vain

Go play with your disk now. It's feeling all lonely and hollow :p
Reply With Quote
  #17  
Old January 4th, 2010, 22:50
mav@ mav@ is offline
FreeBSD Developer
 
Join Date: Feb 2008
Location: Dnepropetrovsk, Ukraine
Posts: 557
Thanks: 0
Thanked 139 Times in 120 Posts
Default

Latest ATA specifications allow drive to announce both logical and physical sector sizes. While logical have to stay 512 bytes for compatibility reasons, physical one can be reported 4K as-is. It would allow OS to self-tune to it better, not just aligning on some "magic" "lucky" offset, as Vista+ do.
Reply With Quote
  #18  
Old January 5th, 2010, 02:55
J65nko J65nko is offline
Member
 
Join Date: Nov 2008
Location: Budel, Netherlands
Posts: 285
Thanks: 1
Thanked 73 Times in 63 Posts
Default

For a similar discussion on the OpenBSD misc mailing list see: http://www.mail-archive.com/misc@ope.../msg84625.html
Reply With Quote
  #19  
Old January 5th, 2010, 20:10
phoenix's Avatar
phoenix phoenix is offline
Moderator
 
Join Date: Nov 2008
Location: Kamloops, BC, Canada
Posts: 3,179
Thanks: 43
Thanked 715 Times in 587 Posts
Default

Quote:
Originally Posted by tty23 View Post
Yes, there are some jumpers on the drive, but unfortunately there is no documentation on what they do (except for one, who should be set for WindowsXP compatibility).
If these are the WD Green drives, the documentation is on the drive itself.

And there's details on how it all works on anandtech and tomshardware.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
  #20  
Old January 5th, 2010, 22:51
tty23 tty23 is offline
Junior Member
 
Join Date: Dec 2009
Posts: 51
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Quote:
If these are the WD Green drives, the documentation is on the drive itself.
Yep, that what I meant with
Quote:
(except for one, who should be set for WindowsXP compatibility).
Reply With Quote
  #21  
Old January 6th, 2010, 01:54
semi-ambivalent semi-ambivalent is offline
Junior Member
 
Join Date: Nov 2008
Posts: 66
Thanks: 7
Thanked 1 Time in 1 Post
Default The Register has a brief take on this

For those that don't have these drives there's a bit of info on them at:

http://www.theregister.co.uk/2009/12...vanced_format/

sa
Reply With Quote
  #22  
Old January 16th, 2010, 15:53
Zap Zap is offline
Junior Member
 
Join Date: Jan 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I also have a problem with 4096 sector size on Transcend StoreJet 18M external USB drive. I tried to install FreeBSD 8.0 stable on this external drive for easy future maintenance.
The sysinstall fdisk reported 8 times lower size. As I was convinient even with that size I tried to make a slice. Then I partitioned it and tried to write the changes. What I got was an error: Unable to make device node for /dev/da0s1a. I couldn't go any further with install.
dmesg reports correct data for the disksize and sector size as does diskinfo.
Livefs fdisk exits with error "could not detect sector size".
What else should I try or how can I help the developers to fix it?
Reply With Quote
  #23  
Old January 19th, 2010, 18:41
jem jem is offline
Member
 
Join Date: Oct 2009
Location: United Kingdom
Posts: 326
Thanks: 17
Thanked 52 Times in 42 Posts
Default

Quote:
Originally Posted by tty23 View Post
Yes, there are some jumpers on the drive, but unfortunately there is no documentation on what they do (except for one, who should be set for WindowsXP compatibility).
Maybe it's this "Windows XP compatibility" mode that forces the drive to report 512 byte sectors. Try removing it and see what is reported to camcontrol afterwards.
Reply With Quote
  #24  
Old January 20th, 2010, 12:03
mav@ mav@ is offline
FreeBSD Developer
 
Join Date: Feb 2008
Location: Dnepropetrovsk, Ukraine
Posts: 557
Thanks: 0
Thanked 139 Times in 120 Posts
Default

I've just compared identify data with and without jumper installed. There is no any difference. Crap!
Reply With Quote
  #25  
Old January 22nd, 2010, 10:30
p5ycho p5ycho is offline
Junior Member
 
Join Date: Nov 2008
Posts: 39
Thanks: 0
Thanked 2 Times in 2 Posts
Lightbulb

Quote:
Originally Posted by jem View Post
Maybe it's this "Windows XP compatibility" mode that forces the drive to report 512 byte sectors. Try removing it and see what is reported to camcontrol afterwards.
I'm willing to bet that this jumper aligns the 4K sectors to the default partition alignment on XP systems. Vista and above align partitions on an offset of exactly 2048 sectors from the start of the drive. XP and earlier use sector 63 i believe, which is not a multiple of 4KB.

So, either use XP compatibility with a default partition alignment, or align all your partitions on 1MB boundaries for compatibility with probably every known partitioning and/or raid stripe (including software raid) and remove the XP compatibility jumper.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding another harddrive...? jigglywiggly General 23 December 23rd, 2009 03:00
FreeBSD, ZFS, SSDs, and proper sector alignment. jnr System Hardware 12 November 18th, 2009 10:17
Installing directly from harddrive? Grubsnik Installing & Upgrading 4 October 1st, 2009 11:59
Mounting a harddrive Roberth General 11 January 20th, 2009 03:55
Install to 2nd harddrive? frito Installing & Upgrading 3 December 30th, 2008 21:10


All times are GMT +1. The time now is 00:40.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0