Reformatting drives with obtuse blocksizes to 512b
So you purchased some OEM rebranded HDD or SSDs secondhand.
It was a SUPER great deal, right?
These likely originated from major a storage vendor such as NetApp, EMC (Fuck EMC), or even HP or Dell.
You’re excited the night your order shows up; Right up until you attach one of these megacheap deals to your host….
Only to discover the drive that you’ve purchased will not initialize….
|
|
Well Fuck.
Much of the rest of this post was paraphrased from This ServeTheHome article…
The most frequent cause of this minor panic-laden moment is that the drive was formatted by the factory with a non standard sector size of 520B or 528B.
refused to initialized drive other than the normal 512B or 4Kb. I read online the reason that these drive are formatted that way is due to some proprietary software that these vendor uses needs the additional sector size for some fancy parity stuff.
Strangely enough… (I know, right?) This IS NOT a gimmick. There’s legit reasons that provide value in vendor-managed environs.
Pro Tip: The secret is that extra 9 of durability
The following is paraphrased from a Freebsd.org forum post:
OK, let’s go to the basics. 520b
and 528b
disks have existed for ages, probably since the 70s.
They probably were more common than 512-byte sector disks until the PC revolution.
The extra bytes can store all manner of things, such as checksums, keys (for CKD data), metadata that links the content (not uncommon in databases), and so on. There are also block sizes that are a little bigger than 4K, for the same reasons. Quite a few industrial-strength disk systems use them.
Today, many industrially used disks are instead formatted using T10-DIF, which also stores checksums on disk. That is kinda… sorta… similar to having 520-byte blocks, but… only kinda sorta.
Also, a lot of file systems (such as ZFS) use checksums, but they do something smarter than 520-byte blocks or T10-DIF
, they store the checksums AWAY from the data, thus allowing the detection of a whole block write going missing
(data and checksum).
All these technologies add real value, and aren’t just a scam to charge customers more.
If you don’t understand what sectors
, logical blocks
, and physical blocks
are, you should probably read the Wikipedia pages about disks….
But, Really quick: At the interface level, the drivers read/write whole logical blocks.
Some disks internally aggregate logical blocks of 512 bytes into physical blocks of 4096 blocks.
The word sector
really shouldn’t be used at the interface level, as it can easily be confused with
Logical block
- (the unit of atomic data transfer)
and
Physical blocks
- The unit of atomic IO.
I know of no common open source file system that can make use of disks with block sizes other than 512 or 4096 bytes. Candidates include ZFS
, UFS
, ext2/3/4
, XFS
..
The post continues, but you get the gist.
- There’s This Wikipedia page on Advanced Format Drives
- Wikipedia Linked to a document from Hitachi providing a tech brief on advanced format drives, which I’ve Cached a copy
for posterity.
Okay… So…
Now we know a bit more about HOW we got here… but uh… what do I do with this paperweight?
After trying to attach the drive in every possible system, through every single controller you have, and still are having no luck, you probably think you’re SOL.
This will coerce your hipster drive to use a sector size of 512B.
You’ll need:
- A linux host
- A JBOD sas/scsi controller This may be more problematic than you’d think. Controllers can be VERY finicky here.
- The
sg3_utils
package - Likely, you’ll ALSO need either:
Look in /var/log/messages
after booting, and you will hopefully see useful information:
|
|
Sweet! Lets get to rippin off them skinny jeans!
|
|
It is pretty simple, and after the format is completed, you should have no problem initializing the drive. However, some drives require a powercycle before successful usage.
Some people argue that the custom firmware on the drive is set to work with sector size 520B or 528B, but during my benchmark, the drive performance was pretty much on par with the normal retail channel.
Hopefully you find this information useful next time you come across a drive with other than 512B sector size.