Categories
Computing Linux Technology

Reformat Drives to 512 bytes / sector

Got some IBM NetApp drives? Or drives from some other big SAN? Operating system can’t see them? They might be low-level formatted to 520 byte sectors or some other oddball size. Many other drives you see on eBay (etc) have this same issue. These drives can be very affordable, but you can’t use them as-is.

This guy- https://youtu.be/BbtPPH3W7nU advises booting CentOS 6 and installing sg3utils, which I did. Under this regime, the drives are referred to as /dev/sgx where x is a number. Not the usual /dev/sdx or /dev/hdx.

  • dnf install sg3_utils
    • (or apt install for debian/ubuntu)
  • sg_scan -i
    • Look, it sees all my drives!
  • Format the drive:
    • sg_format --format --size=512 --fmtpinfo=0 /dev/sg3
    • Yup, sg3, not sdc
      • More recently, 2021-05-21, the syntax above worked perfectly,
      • Formatting two drives on the same controller (run from two different consoles) took 96m 16s
    • Sometimes this FAILED, so I did  this:
    • sg_format --FFF --size=512 --fmtpinfo=0 /dev/sg3
    • This forces the format, even if it can’t read the sense key properly.
    • If this completes without error, try it again without the -FFF, using just -F instead.
    • Using -FFF completes without error, but repeating with -F fails again.
    • So upon further research, I tried this:
    • sg_format --F --size=512 --six --fmtpinfo=0 /dev/sg3
    • The six option can be used in case the drive cannot be formatted with default 10 byte MODE SENSE/SELECT
    • Works much better (but no faster.) Eventually finished, 140m, 16s later, or 2 hours, 20 minutes, 16 seconds.
    • The drives work fine now, as do all drives I tried this on.

Leave a Reply

Your email address will not be published. Required fields are marked *