The arrow of time

Ivan Voras' blog

Have an WD EARS drive or other 4k sector drive? Try this.

The industry is moving toward 4k-sectored hard disk drives - a bit late though but better late then newer. However, in the interim period where compatibility for 4k sector drives is not widespread, drives such as WD's EARS series are using internal translation to present themselves as 512-byte sector drives, leading to unexpectedly horrible write performance. As a band-aid I'm proposing an almost trivial patch to glabel which allows it to have a "forced sector size" specified and as a result can present 4k sectors to the file system even if the physical drive doesn't. See also: glabel.

Users of such drives are hereby invited to test the patch! It applies to HEAD but should also cleanly apply to 8-STABLE.

However, there is a dispute if this is a "clean enough" method of supporting 4k drives to bring into FreeBSD. As this really should be a temporary solution either until drives stop presenting themselves as 512-byte sectored or a "native" support appears for 4k sectored drives and it's not exactly glabel's primary job to translate geometry, I see the other side's view. But I think there are also good sides to it:

  • glabel is in GENERIC kernel by default (and unlike say, em driver, its purpose is to label drives and other providers as "something"), so people are using it and are familiar with it.
  • The patch really is simple, basically adding a metadata field and using it in GEOM creation, which is also very clean (due to the good design of GEOM). 
  • A separate GEOM class to do this will look exactly like glabel does now (basically I can copy-paste glabel), with support for partition and file system metadata removed. I'm not against this approach.
So far, it's two against one (me being the one) in favour of not committing it, so I'm basically gathering support now. I will revisit this topic before 9.0 gets frozen because it would really suck not to have any kind of support for 4k drives in a brand new release. Of course, if native support actually appears, all this will be needless.
On the other hand, the good news is that UFS apparently works fine with 4k sector drives, and so does GEOM, meaning that, except for recognizing that the drives are actually 4k-sectored instead of 512-byte sectored, FreeBSD has supported 4k drives practically forever (or more precisely something like 2003). This is completely orthogonal to disk partition table formats (like fdisk/MBR and disklabel) which may or may not support it.

#1 Re: Have an WD EARS drive or other 4k sector drive? Try this.

Added on 2010-08-08T22:57 by Anonymous

Try Linux! It support's 4K drives out of the box since 2009.

#2 Re: Have an WD EARS drive or other 4k sector drive? Try this.

Added on 2010-08-09T10:06 by Tomasz

I believe some of those drives have a physical jumper which would make them lie and report 512b sectors. Removing this jumper corrects reporting to 4KiB.

#3 Re: Have an WD EARS drive or other 4k sector drive? Try this.

Added on 2010-08-09T11:58 by tty23

@ Tomasz I asked WD support if there is a jumper for that. Apparently not..

 

#4 Re: Have an WD EARS drive or other 4k sector drive? Try this.

Added on 2010-08-12T19:35 by Tomasz

Yes, sorry. There is a jumper to offset LBA addressing by one to accomodate some legacy operating system. There;s no fix for reporting 512 sector size, it is broken firmware.

But other 4KiB drives do not have this problem and report true sector size.

#5 Re: Have an WD EARS drive or other 4k sector drive? Try this.

Added on 2010-10-09T13:15 by Valery

My 8.0-R-amd64 shows error at last line of

--- sbin/geom/misc/subr.c	(revision 211037)
+++ sbin/geom/misc/subr.c	(working copy)
@@ -436,7 +436,8 @@
 				abort();
 			}
 		} else if ((int)len != argp->len) {
-			fprintf(stderr, "Wrong length %s argument.\n", param);
+			fprintf(stderr, "Wrong length %s argument. "
+			    "Got %d, expecting %d.\n", param, argp->len, len);


I chanded last line

+ "Got %d, expecting %ld.\n", param, argp->len, len);

 

#6 Re: Have an WD EARS drive or other 4k sector drive? Try this.

Added on 2010-10-09T13:23 by Ivan Voras

Your change looks ok; though you could skip patching this specific file, it's only for informative debug info.

#7 Re: Have an WD EARS drive or other 4k sector drive? Try this.

Added on 2010-12-12T01:04 by John

The most stupid thing 4k drive manufacturers did is that NONE of currently released 4k drives have jumper to change them to 4k native mode. They all lie to OS they are 512b sector drives because Microsoft was just too lazy to take care about technology improvement and not implemented native 4k sector even in Windows 7. Even more stupid things go to the market with new 3TB drives - instead of reporting native 4k sector size, they are bundling hardware PCI adapter with the drive to overcome Windows driver problems!

The only correct behaviour must be native 4k sector presentation to the OS (both logical and physical), and the jumper for those who want some emulations.

As soon as the first manufacturer will release drive with native 4k sector to OS, I will ban purchasing the drives that can only lie to OS about sector size.

Another point, that I cannot understand whats wrong to use native 4k sectors. I tried that on Windows 7 (the Promise M500i disk array I had can emulate any sector size to the OS from 512b to 4k) and I found no problems to use 4k sectors. Many disk manipulation programs will not work but I am using PCs to run business applications, not disk tweaking applications.

Post your comment here!

Your name:
Comment title:
Text:
Type "xxx" here:

Comments are subject to moderation and will be deleted if deemed inappropriate. All content is © Ivan Voras. Comments are owned by their authors... who agree to basically surrender all rights by publishing them here :)