
Discovering Hard Disk Physical Geometry Through Microbenchmarking - rrampage
http://blog.stuffedcow.net/2019/09/hard-disk-geometry-microbenchmarking/
======
userbinator
_By symmetry, there are two similar layouts that order cylinders from inside
to outside, but I have not seen these used._

That's because the fastest transfer speeds occur at the outside, and drives
are filled starting from the first logical block (often the first set of files
to appear on a drive is the OS), so it makes sense to.

Interestingly, optical media (DVDs, CDs, BDs, LDs) start at the _innermost_
radius so the fastest transfer speeds are at the end. On the other hand, bare
optical media is handled physically and the outer edges are more likely to be
damaged, so it makes sense to start on the inside (and the initial sectors
contain critical information about the media, which if damaged would render it
completely unreadable) --- I don't know if this is the official reason for the
layout, but it's plausible. Here's an informative graphic comparison:

[https://en.wikipedia.org/wiki/File:Comparison_disk_storage.s...](https://en.wikipedia.org/wiki/File:Comparison_disk_storage.svg)

~~~
codeflo
IIRC correctly, unlike HDDs, (audio) CD players change their rotation speed to
match the data density, because they need the data at a constant bit rate. So
it wouldn’t matter whether the data starts inside or outside. I think your
argument about physical robustness is very plausible.

Additionally, starting from the inside allowed for physically smaller disc
formats without any special software support:
[https://en.m.wikipedia.org/wiki/Mini_CD](https://en.m.wikipedia.org/wiki/Mini_CD)

I don’t know for sure if that possibility was part of the original design. But
it must have been introduced somewhat early, given that every CD player tray
I’ve ever seen has that extra ridge to hold the smaller discs in place.

~~~
dfox
CDDA is purely CAV optical medium.

~~~
nezgar
CDDA is CLV.
[https://en.m.wikipedia.org/wiki/Constant_linear_velocity](https://en.m.wikipedia.org/wiki/Constant_linear_velocity)

CD ROM drives may spin CD's with CAV, but if so the data rate changes,
increasing steadily towards the outer edge of the disc.

~~~
throwaway3563
I suspect CD ROMs used CAV (in contrast to audio CDs which used CLV) because
the processors (perhaps originally based off audio processors) could intially
only deal with a fixed data rate, and with CLV + random access, the drive
would have to spin up and down repeatedly according to where on the disk the
laser had seeked to, which would have a large impact on random access times.
As the speed of drives got faster and faster (up to 52x) that problem wouldve
been exacerbated too.

------
SamReidHughes
One other thing you might want to measure is how quickly you can do a write to
disk. On some 2.5" WD Black drive I was benchmarking years back, I got a ~2 ms
minimum time between uncached writes. Keep in mind it's 8.333 ms per rotation
on a 7200 RPM drive. The simplest methodology is to perform a write at sector
zero, wait until it's acked, then perform one at sector N, and see how low you
can set N. It was a bit less than a quarter the way around the track.

So if you wanted to optimize your file system for some sequential fsync
workload (which iirc affected Firefox performance at some point), well, you
might want strategically placed regions around disk for updating your write-
ahead log.

That drive burnt 230 μs just doing a cached write, which only took 30 μs (or
60?) on an Intel SSD, so there was a lot of fluff going on.

~~~
hinkley
He says that short stroking only improves iops by about 20%, which is nothing
to sneeze at but also not that impressive.

~~~
SamReidHughes
The case I'm talking about is no-stroking, where you're on the same track.

------
aasasd
People do approximately the same thing with flashbench on SD cards, to figure
out the best alignment for more speed and less wear. RAID options of Ext4 are
also exploited on both SD and SSD, to get the fs to align writes to desired
block sizes. See
[https://wiki.gentoo.org/wiki/SDCard](https://wiki.gentoo.org/wiki/SDCard) and
[https://thelastmaimou.wordpress.com/2013/05/04/magic-soup-
ex...](https://thelastmaimou.wordpress.com/2013/05/04/magic-soup-ext4-with-
ssd-stripes-and-strides/)

------
sgillen
Really glad people like the author exist. Who would do all this (presumably)
on their own time, merely to satisfy their own curiosity.

Bravo!

~~~
shaklee3
Yes, this is as detailed as the last article about c++ vs rust
microbenchmarks. Excellent content, and likely tooka really long time to
write.

------
h2odragon
Astounding depth. Reminds me of tuning interleaves with SpinRite, some time
before the old disk he's using was made.

------
hinkley
Turns out I had some exceedingly out of date ideas of how sectors are laid out
on the platters.

Now I understand some of the conversations about logical cylinder addressing
when drives first started getting too big for the addressing scheme.

------
gameshot911
One of the coolest articles I've seen in a long time!

------
Nextgrid
I’m surprised this hasn’t (yet) been exploited in one way or another for
fingerprinting.

~~~
userbinator
Something similar has been used for detecting faked drive specifications and
rotational speeds:

[https://forum.hddguru.com/viewtopic.php?t=38333](https://forum.hddguru.com/viewtopic.php?t=38333)

(That site and the HDDoracle one linked from there have _lots_ of low-level
information about hard drives, mostly in the context of data recovery.)

