520 to 512 sector size shenanigans

Dirt cheap drives

Recently I've purchased half a dozen of cheap 1.2TB 2.5'' SAS HDDs from a NetApp appliance.
They're fairly good deal for the amount of elbow grease that you need to put in for something like Dell R630 with H730 mini.


Insipiration

This adventure is only possible due to this fantastic post by wendell from level1techs, you can find it here

The drives and the struggle

 The drives come in a nice long cage and you need to unscrew four screws to release it from its prison.
Once they're out you're good to put them into your own cage.

If those drives were pulled straight out of NetApp appliance they'll be formatted with 520 bytes sectors.
Most RAID controllers, like H730 in my R630, are severly allergic to 520 bytes sectors and no matter what you do they'll not be able to interact with the actual storage.

The RAID controller in RAID mode will "see" the drives but you are unable to switch them from "Ready" to "Non-Raid" or add them to a RAID.
The operation job fails.

In HBA mode, you are also unable to directly interact with the drives, at least, I wasn't able to.
They just would not show up to the host OS.

Convoluted solution

I had a pleasure of dealing with 520 byte sector drives before with a HP DL380p Gen 8.
The solution was to use a different RAID controller, in my case I got a HP P822.

This RAID controller can be switched to HBA mode and it will pass disks to the host OS just fine.

So I've done what I did before.

Bunch of cables

Have you ever created a monstrosity so ugly you cry at its sight? Me neither.


The P822 is connected to a free PCIe port in a desktop PC, the HP server is on so the backplane and the drives have power.
The desktop is booted into Ubuntu and from there we will be able to see our drives.
It just works like that.

They'll come up as /dev/sd* and return 0 bytes from lsblk

Since we see the drives we can now interact with them.
Next course of action is to get sg3-utils via apt like so:
apt install sg3-utils

After that you can issue a reformat like so:
sg_format -v --format --size=512 /dev/sdx
/dev/sdx will be our 520 byte sector drive

Issuing the command will display information about the drive including the sector size.
After several seconds the format will begin so you can plently of time to back-out if you accidently picked HDD with pictures of all of your cats.

In case of a 1.2TB HDD the format took around 2 hours.
The benefit of the frankenstein approach is the ability to format multiple drives at the same time with adequate cooling.

Cage 'em up and lock 'em in

Once the format is complete you can use those drives.
They will show up just fine even under the H730.

 One weirdness with these drives is the activity LED for the cage is always lit but it still blinks during activity.

In Proxmox I was able to create a modest ZFS pool out of the 6 drives.

Comments