How to reformat HDD & SSD to 512B Sector Size

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

WiteWulf

New Member
Jul 14, 2023
10
5
3
A little addendum, in case anyone runs into the same problem as me: I took the newly sg_format'd disks from the chassis I was using to format them in (and that they'd been confirmed as working when connected to the Cisco 12G Modular SAS RAID controller in JBOD mode) and popped them in my live server (another Cisco UCS chassis with the same model Cisco 12G Modular SAS RAID controller in it). The disks immediately went into error mode, "unconfigured bad", and the CIMC refused to do anything with them.

So I shut down the guests and the ESXi host on the machine, power cycled it and went into the RAID controller BIOS (pressing ctrl-r when prompted). The RAID controller was quite happy with the disks and let me configure them as RAID volume or as JBOD disks. When I saved the config and rebooted again the CIMC was happy with the disks and cleared all the errors.
 

RulerOf

New Member
Aug 23, 2017
6
0
1
38
I decided to get myself some 3PAR-branded DC HC530 drives that came formatted with 520-byte logical sectors. The datasheet says they can be reformatted between all of the various sector sizes, including "fast format," and I was able to convert them from 520/4160 to 512/4096. It's a two-step process, 520 -> 4160 via fast format, then 4160 -> 4096 via full format.

  • Check the formatting, see it's 520 byte logical
Code:
[root@drew-metal ~]# sg_readcap /dev/sg48
READ CAPACITY (10) indicates device capacity too large
  now trying 16 byte cdb variant
Read Capacity results:
   Protection: prot_en=0, p_type=0, p_i_exponent=0
   Logical block provisioning: lbpme=0, lbprz=0
   Last LBA=26789019647 (0x63cbfffff), Number of logical blocks=26789019648
   Logical block length=520 bytes
   Logical blocks per physical block exponent=3 [so physical block length=4160 bytes]
   Lowest aligned LBA=0
Hence:
   Device size: 13930290216960 bytes, 13284960.0 MiB, 13930.29 GB, 13.93 TB
  • Convert to 4160 using fast format
Code:
[root@drew-metal ~]# sg_format --format --size=4160 --ffmt=1 --six --quick -v /dev/sg48
    WDC       WLEB14T0S5xeN7.2  3P00   peripheral_type: disk [0x0]
      PROTECT=1
      << supports protection information>>
      Unit serial number:         9FAKEJ4L
      LU name: 5000cca2591ce380
    mode sense(6) cdb: 1a 00 01 00 fc 00
Mode Sense (block descriptor) data, prior to changes:
block count maxed out, set <<longlba>>
    mode sense(10) cdb: 5a 10 01 00 00 00 00 00 fc 00
  <<< longlba flag set (64 bit lba) >>>
  Number of blocks=26789019648 [0x63cc00000]
  Block size=520 [0x208]
    mode select(10) cdb: 55 11 00 00 00 00 00 00 24 00
    Format unit cdb: 04 10 00 00 01 00

Format unit has started
FORMAT UNIT Complete
  • Validate 4160 conversion
Code:
[root@drew-metal ~]# sg_readcap /dev/sg48
Read Capacity results:
   Last LBA=3348627455 (0xc797ffff), Number of logical blocks=3348627456
   Logical block length=4160 bytes
Hence:
   Device size: 13930290216960 bytes, 13284960.0 MiB, 13930.29 GB, 13.93 TB
  • Convert to 4096 (very slow, takes ~16 hours)
Code:
[root@drew-metal ~]# sg_format --format --size=4096 --ffmt=0 --six --quick -v /dev/sg48
    WDC       WLEB14T0S5xeN7.2  3P00   peripheral_type: disk [0x0]
      PROTECT=1
      << supports protection information>>
      Unit serial number:         9FAKEJ4L
      LU name: 5000cca2591ce380
    mode sense(6) cdb: 1a 00 01 00 fc 00
Mode Sense (block descriptor) data, prior to changes:
  Number of blocks=3348627456 [0xc7980000]
  Block size=4160 [0x1040]
    mode select(6) cdb: 15 11 00 00 18 00
    Format unit cdb: 04 18 00 00 00 00

Format unit has started
Format in progress, 0.00% done
Format in progress, 0.10% done
<snip>
Format in progress, 99.75% done
Format in progress, 99.85% done
Format in progress, 99.95% done
FORMAT UNIT Complete
  • Validate the new block size
Code:
[root@drew-metal ~]# sg_readcap /dev/sg48
Read Capacity results:
   Last LBA=3418095615 (0xcbbbffff), Number of logical blocks=3418095616
   Logical block length=4096 bytes
Hence:
   Device size: 14000519643136 bytes, 13351936.0 MiB, 14000.52 GB, 14.00 TB
  • Rescan disks to allow mounting, then enjoy your formatted disk
Code:
partprobe
 
Last edited:

josep gatius

New Member
Aug 17, 2020
3
0
1
Catalunya
Good evening,
I have a dubt. i bought several SSD. Toshiba PX04SUB040.
Server LENOVO -IBM
Controller of the server
RAID M5210 SAS/SATA

I can see the disks from AVAGO. But i can not interact with it. With the other ones i was able to.
When I turn on SG-SCAN it detects the first ones, but i can't detect the other 5 toshiba. Could it be possible that the problem is in the controller?
What do you think could be happening?
Thank you.