How would I force Debian to use the physical sector size on a hard disk?

9

1

I just purchased a few new 3TB WD drives. These have physical 4k sectors, but there is some sort of layer which is providing 512B logical sectors (see the partition table below).

In order to attempt to get some more speed out of my hard drives, I would like to get rid of this logical layer and actually use the physical 4k sectors. However, I can't figure out how to do this (or even if it's possible) from the man pages of fdisk and parted, or from searching Google. Does anybody know how this could be done?

As to why this is relevant, this page demonstrates that meerly aligning the sectors properly can already make up to a 25% speed difference for reads, and more than 2500% for writes in some cases! Getting rid of the logical sectors in favor of the physicals ones should improve speeds even more. Thanks!

$ parted /dev/sdc
GNU Parted 2.3
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA WDC WD30EZRX-00M (scsi)
Disk /dev/sdc: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  3001GB  3001GB               zfs
 9      3001GB  3001GB  8389kB

P.S. I don't care about the data on the drives, I was just playing with different file systems. Also, this is my first time posting here, so please let me know if my posts should be formatted differently, etc.

New sysadmin

Posted 2012-06-30T19:14:14.577

Reputation: 103

Answers

5

According to an interview with a Western Digital representative published on http://www.techarp.com/showarticle.aspx?artno=734 there is no option to disable 512e emulation on current Advanced Format drives.

[...] will Western Digital offer firmware upgrades that would convert current Advanced Format drives running in emulation mode, to the native format?

Unfortunately, no. Current Advanced Format drives cannot be converted to run in the native format through a firmware upgrade

Gurken Papst

Posted 2012-06-30T19:14:14.577

Reputation: 3 874

1Is this answer still valid in 2017? – Fabian Thommen – 2017-06-22T09:53:20.673

1If there isn't any way to do it at the disk level, what about at the operating system level. That is, tell debian to only write to the disk in 4k-blocks. Or, because of the way the disk works, would this not actually improve read/write speeds? Thanks! – New sysadmin – 2012-06-30T21:56:45.827

Interesting question. If there was no write cache, there should be a major impact indeed, like when writing small chunks on flash memory. But since there are some MB of cache on the disk drive I guess this will be no problem at all. If there is a sequential write to consecutive logical sectors, the drive could just delay writing to the disk until eight logical sectors have been written. While the logical sector emulation is unnecessary in your case, it is likely fast enough to not slow down writing at all. – Gurken Papst – 2012-06-30T22:10:59.213

Hmm. That seems logical, only then why would the page I referenced in the original post show significant decreases in write performance for misaligned partitions (i.e. ones that start on a logical rather than physical sector) even for large files. If what you're suggesting was the whole story, I would assume that the cache would handle this fine, too, but it clearly doesn't........ – New sysadmin – 2012-06-30T22:22:50.907

Since there are significant differences between the file systems my guess is that Reiser uses some rather complex pattern and/or adverse block size when writing and the cache algorithm is not capable of eliminating multiple writes to the same sector while it can do so for ext4. While this is only a guess there is another point why 512e emulation should be no penalty on aligned partitions: If it was, manufacturers would likely already have implemented an option to turn emulation of since it would be trivial and competition would them force to do so. – Gurken Papst – 2012-06-30T22:54:30.853