Skip to contentSkip to conversation

WDC WD20EARS and 4k sector size

DISCUSSION Herbert Poetzl 7 participants 11 messages Jan 25, 2011 libata

lore
Share & tools
lore
#0 lore raw

I recently bought the WDC WD20EARS-00MVWB0 because it was really cheap for a drive with 64 MB cache, and I wanted to try out a 4k sector size disk ...

Now the drive performs quite well, is rather silent and doesn't use much power or produce much heat, but at first I didn't find anything in Linux indicating that this drive would actually use 4k sectors.

To shorten things, I asked around on IRC, had a chat with some other folks, found a jumper description on the WD site talking about an 'Advanced Format' jumper and finally contacted WD in a lengthy email thread.

The results of all this are:

- the drive doesn't report 4k sectors at all, not even as physical sector size.

- the 'Advanced Format' jumper shifts access to the the drive by one sector.

I did some tests to verify that, and I can confirm the behaviour of the jumper in question with certain benchmark tests (using dm and bonnie++) with and without the jumper in place.

My question now is, how can I tell the kernel that this drive actually has 4k physical sectors and that it would be a smart thing to send requests in some kind of 4k I/O chunks?

Many thanks in advance,
Herbert

PS: if somebody is interested in the tests done to verify the jumper, please let me know ...

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Herbert" == Herbert Poetzl <[email protected]> writes:

Herbert> - the drive doesn't report 4k sectors at all, not
Herbert> even as physical sector size.

There have been numerous threads on this list about EARS not reporting block sizes correctly. Check the archives.

Herbert> My question now is, how can I tell the kernel that this drive Herbert> actually has 4k physical sectors and that it would be a smart Herbert> thing to send requests in some kind of 4k I/O chunks?

Align your partitions on a 4K boundary.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
Quoted 7 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Herbert" == Herbert Poetzl <[email protected]> writes:

Herbert> - the drive doesn't report 4k sectors at all, not
Herbert> even as physical sector size.

There have been numerous threads on this list about EARS not reporting block sizes correctly. Check the archives.

really? well, they probably use strange subjects or the search function on the archives is broken ...

I did a search on the archives, and I get a totla of 30 threads containing EARS (in linux-ide) and most of them talk about something completely different (like rabbit ears :)

Quoted 5 lines

Herbert> My question now is, how can I tell the kernel that this drive Herbert> actually has 4k physical sectors and that it would be a smart Herbert> thing to send requests in some kind of 4k I/O chunks?

Align your partitions on a 4K boundary.

While this will ensure that the drive performance is better than without doing so (I'm not using a partition table on that drive anyways, but I get what you mean), this doesn't inform the kernel about proper I/O sizes and for sure doesn't prevent unnecessary read-change-write operations for the disc ...

best,
Herbert

Quoted 6 lines
Signature · 5 lines
Martin K. Petersen	Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 22 lines · Herbert Poetzl
Quoted 7 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Herbert" == Herbert Poetzl <[email protected]> writes:

Herbert>  - the drive doesn't report 4k sectors at all, not Herbert>    even as physical sector size.

There have been numerous threads on this list about EARS not reporting block sizes correctly. Check the archives.

really? well, they probably use strange subjects or the search function on the archives is broken ...

I did a search on the archives, and I get a totla of 30 threads containing EARS (in linux-ide) and most of them talk about something completely different (like rabbit ears :)

Quoted 5 lines

Herbert> My question now is, how can I tell the kernel that this drive Herbert> actually has 4k physical sectors and that it would be a smart Herbert> thing to send requests in some kind of 4k I/O chunks?

Align your partitions on a 4K boundary.

Quoted 8 lines

While this will ensure that the drive performance is better than without doing so (I'm not using a partition table on that drive anyways, but I get what you mean), this doesn't inform the kernel about proper I/O sizes and for sure doesn't prevent unnecessary read-change-write operations for the disc ...

best,
Herbert

Filesystems in general use a 4K or 8K blocksize. Those are of course sent to the drive in logical sector units where they get aggregated by the drive and written to the physical media.

There is nothing more that can be done.

So if it is aligned, all is good. If not, performance sucks. So the goal of supporting 4K physical sectors is primarily to ensure a performance degradation is not introduced due to mis-alignment.

Good Luck
Greg

#4 lore raw
In reply to Herbert Poetzl
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Herbert" == Herbert Poetzl <[email protected]> writes:

Align your partitions on a 4K boundary.

Herbert> While this will ensure that the drive performance is better Herbert> than without doing so (I'm not using a partition table on that Herbert> drive anyways, but I get what you mean), this doesn't inform Herbert> the kernel about proper I/O sizes

The kernel doesn't enforce any "proper" I/O sizes at runtime other than the logical block size.

Herbert> and for sure doesn't prevent unnecessary read-change-write Herbert> operations for the disc ...

The other crucial component is passing the relevant options to mkfs.foo to ensure the filesystem is formatted with 4KiB blocks.

If the drive had reported its block size correctly mkfs would have picked this information up automatically. In this case, since the drive doesn't indicate that it's using Advanced Format, you'll have to pass the block size to mkfs by hand.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#5 lore raw

On 11-01-24 10:52 PM, Martin K. Petersen wrote:
..

Quoted 2 lines

If the drive had reported its block size correctly mkfs would have picked this information up automatically.

Apparently revision 00Z drives now show 4096 physical sector size, with 512 for logical. Can anyone out there confirm this first-hand? (hdparm -I)

Thanks

#6 lore raw
Quoted 8 lines · Mark Lord

On 11-01-24 10:52 PM, Martin K. Petersen wrote:
..

Quoted 2 lines

If the drive had reported its block size correctly mkfs would have picked this information up automatically.

Apparently revision 00Z drives now show 4096 physical sector size, with 512 for logical. Can anyone out there confirm this first-hand? (hdparm -I)

There's no "00Z" revision for 20EARS, as far as I can tell. There is, however, 00Z revision for 15EARS, which is 1.5Tb.

I've this drive:

 Model Family:     Western Digital Caviar Green (Adv. Format) family
 Device Model:     WDC WD20EARS-00MVWB0
 Serial Number:    WD-WMAZ20464440

Firmware Version: 50.0AB50

this was the latest (the 3-platter version) of the drive as were available ~2 months ago.

This drive does NOT report 4kb, it tells that both logical and physical sector size is 512 bytes. But it actually uses 4kb sectors internally, which is visible when writing by chunks of <4Kb with O_DIRECT: any size which is not multiple of 4Kb and performance drops for a factor of 3..4.

Reportedly, WD15EARS with 00Z firmware does report all the parameters correctly. I've no idea what about WD10EARS, more recentl 2TB+ drives and why they don't have (or do they?) "right" firmware for 20EARS...

Thanks!

/mjt

#7 lore raw
In reply to Herbert Poetzl

Hello,

Quoted 7 lines · Herbert Poetzl
Quoted 1 line

Align your partitions on a 4K boundary.

While this will ensure that the drive performance is better than without doing so (I'm not using a partition table on that drive anyways, but I get what you mean), this doesn't inform the kernel about proper I/O sizes and for sure doesn't prevent unnecessary read-change-write operations for the disc ...

Kernel doesn't really care. Well, the fs should align things to 4KiB but all the modern ones already do so. The only thing necessary is aligning the partition table. Whether the drive lies about physical sector or not, most modern distros unconditionally align partitions to 1MiB. So, as long as you use a distro which was released in the past six month, there's nothing to worry about.

Thanks.

Signature · 1 line
tejun
#8 lore raw
In reply to Herbert Poetzl
Quoted 8 lines · Herbert Poetzl

I recently bought the WDC WD20EARS-00MVWB0 because it was really cheap for a drive with 64 MB cache, and I wanted to try out a 4k sector size disk ...

Now the drive performs quite well, is rather silent and doesn't use much power or produce much heat, but at first I didn't find anything in Linux indicating that this drive would actually use 4k sectors.

See https://ata.wiki.kernel.org/index.php/ATA_4_KiB_sector_issues

#9 lore raw
In reply to Herbert Poetzl
Quoted 10 lines · Herbert Poetzl

I recently bought the WDC WD20EARS-00MVWB0 because it was really cheap for a drive with 64 MB cache, and I wanted to try out a 4k sector size disk ...

Now the drive performs quite well, is rather silent and doesn't use much power or produce much heat, but at first I didn't find anything in Linux indicating that this drive would actually use 4k sectors.

Quoted 4 lines

To shorten things, I asked around on IRC, had a chat with some other folks, found a jumper description on the WD site talking about an 'Advanced Format' jumper and finally contacted WD in a lengthy email thread.

My understanding about that jumper is that
you DO NOT WANT THE JUMPER ON.

Without the jumper, sector 0 is 4KB aligned,
as is any sector multiple of 4.

But WITH the jumper, sector 0 is no longer 4KB aligned.. everything shifts by one (or seven) such that sector 63 ends up being the start of a 4KB low-level sector, instead of the more sensible sector 64.

Right?

#10 lore raw
Quoted 22 lines · Mark Lord
Quoted 9 lines · Herbert Poetzl

I recently bought the WDC WD20EARS-00MVWB0 because it was really cheap for a drive with 64 MB cache, and I wanted to try out a 4k sector size disk ...

Now the drive performs quite well, is rather silent and doesn't use much power or produce much heat, but at first I didn't find anything in Linux indicating that this drive would actually use 4k sectors.

Quoted 4 lines

To shorten things, I asked around on IRC, had a chat with some other folks, found a jumper description on the WD site talking about an 'Advanced Format' jumper and finally contacted WD in a lengthy email thread.

My understanding about that jumper is that
you DO NOT WANT THE JUMPER ON.

Without the jumper, sector 0 is 4KB aligned,
as is any sector multiple of 4.

Quoted 6 lines

But WITH the jumper, sector 0 is no longer 4KB aligned.. everything shifts by one (or seven) such that sector 63 ends up being the start of a 4KB low-level sector, instead of the more sensible sector 64.

Right?

yes, that is what I found out and what got confirmed by WD folks via E-mail, if you are using 4k aligned partitions, DO NOT use the jumper, if you are using DOS partitions starting at sector 63, this jumper will improve the performance by shifting everything by one 512 byte sector ...

why it is called 'Advanced Format' in the documentation available from WD is beyond me.

best,
Herbert

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html