[HowTo] Reformatting enterprise storage drives to 512 bytes

Problem

Recently I got my hands on some old HPE 3PAR 1.92TB SAS SSDs (Samsung PM1633a). I though they would be perfect for my SDDC home lab - sadly they did not work as intended with my HPE DL360 server. The SmartArray P420i was recognizing the disks but was giving the error "This physical drive does not support RAID and is not exposed to OS. It cannot be used for configuration on this controller". But hopefully there is a solution to the problem we are facing:

Basically the drives in a 3PAR Storage System use 520Bytes blocks as a low-level formatting. We need 512 Bytes for standard Operating Systems like Linux (520 Bytes does enable T10 DIF CRC error checking - the extra 8 Bytes are designated for data integrity/protection [1])

Solution

TL;DR:

  • connect to SAS Drives to a HBA or RAID-Controller in HBA Mode
  • Install a OS (Windows or Linux) on a seperate, already working drive - or just use a live version
  • install sg3_utils package [2]
  • run π™¨π™œ_π™¨π™˜π™–π™£ and π’”π’ˆ_π’‡π’π’“π’Žπ’‚π’• --π’‡π’π’“π’Žπ’‚π’• --π’”π’Šπ’›π’† 512 𝑷𝑫𝒙 to reformat the disks to 512 Byte blocks

The first step is to install the disk in a system with only a simple SAS HBA - most raid adapters will give you errors when you want to expose the disk to the OS. We need SCSI Access from a OS to do some commands. I used a HPE P420i in HBA Mode (Note: to be able to set your RAID Controller to HBA Mode, no logical drives should be present)

Next install a OS on a already working drive, I used Rocky Linux - a live version also works fine. To be able to format the drives we need sg3_utils. Simply install the package with dnf:

1sudo dnf install sg3_utils

Then with the help of sg3_utils package we run some commands. First we need to list all SCSI drives and get their ID (PDx)

Windows

1sg_scan

Then format one drive at a time (in this case PD1)

1sg_format --format --size 512 PD1

Linux

1sg_scan -i

Then format one drive at a time (in this case sg3)

1sg_format --format --size 512 /dev/sg3

Now the disks are formatted with 512 byte blocks and you should be able to use the disk in a JBOD or RAID.

References

[1] https://www.openfabrics.org/images/2018workshop/presentations/307_TOved_T10-DIFOffload.pdf

[2] https://sg.danny.cz/sg/sg3_utils.html