Change disk sector size from 520 bytes to 512 bytes

If you happen to have an old SAN which contains perfectly usable disks, you might experience that hooking these disks onto youe SAS HBA/Raid-controller won’t work out of the box. I recently pulled 11 disks from an old EMC AX-4 for reuse in a PowerEdge 720XD (10 disks for RAID-10 plus 1 hotspare and 1 SSD for CacheCade), and noticed that the disks had an unsupported formatting. I forgot to screenshot the info from my disks, so I snipped the info from

From dmesg

[ 86.717949] Vendor: IBM Model: IC35L146 CLAR146 Rev: R58A 
[ 86.717970] Type: Direct-Access ANSI SCSI revision: 03 
[ 86.720959] sdb : unsupported sector size 520. 
[ 86.720966] SCSI device sdb: 0 512-byte hdwr sectors (0 MB) 
[ 86.722822] sdb: Write Protect is off 
[ 86.722828] sdb: Mode Sense: e3 00 00 08 
[ 86.725797] SCSI device sdb: drive cache: write through 
[ 86.725908] sd 0:0:1:0: Attached scsi disk sdb 
[ 86.726103] sd 0:0:1:0: Attached scsi generic sg1 type 0

As can be seen – these disks had an unsupported sector size (520 vs the regular 512). In order to get the disks working I installed the sg3_utils on my CentOS machine.

Perform a scan and see the disks available for a sector size change

# sg_scan -i
/dev/sdb: scsi channel=0 id=2 lun=0
Vendor: IBM Model: IC35L146 CLAR146 [rmb=0 cmdq=1 pqual=0 pdev=0x0]

As said – my output wasn’t exactly like this, but you get the idea… Then perform the sector size change

# sg_format –format –size=512 /dev/sdb
Vendor: IBM Model: IC35L146 CLAR146 peripheral_type: disk [0x0]
Mode Sense (block descriptor) data, prior to changes:
Number of blocks=573653847 [0x22314357]
Block size=520 [0x208]
A FORMAT will commence in 10 seconds
ALL data on /dev/sg8 will be DESTROYED
Press control-C to abort

I had Seagate 600GB 15k disks, and I believe the formatting was close to 60 minutes per disk. I had 11 of these, and to speed things up I just did’em all in parallell 😉 The PERC complains about unsupported disks, but I imagine these disks will work just fine in our dev-environment.

2022 Update

Tried the same procedure with some old SAN SSDs, and the command now (Ubuntu Server 20.04) is

sg_format -v –format –size=512 /dev/sgX

root@ubnt20:~# sg_format -v --format --size=512 /dev/sg4
TOSHIBA 5SRB384C EMC3840 PC4A peripheral_type: disk [0x0]
<< supports protection information>>
Unit serial number: 87J0A06XT3EE
LU name: 58ce38e07c9000ed
mode sense(10) cdb: 5a 00 01 00 00 00 00 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=7348420608 [0x1b6000000]
Block size=520 [0x208]
mode select(10) cdb: 55 11 00 00 00 00 00 00 24 00

3 kommentarer om “Change disk sector size from 520 bytes to 512 bytes

  1. If you do not mind telling me what OS and raid controller did you use to perform this process? I too, have some EMC drives that I would like to change the byte sector on.


    • Hi,
      This was done a while back, but I believe I used CentOS 6.5 as the OS. In order to perform the operation I believe you have to use a SAS-controller rather than the regular PERCs like the H700 or similar as you won’t be able to create any type of RAID when the controller does not recognize the disk. Most likely I used a «hacked» PERC H200 (with LSI-firmware supporting IT-mode) or the LSI 2008. My experience is limited to LSI-based HBAs, but as long as it’s supported by the OS I belive you should be fine 🙂

  2. Ok thats good to know. I am using an LSI CISCO SAS 2008M 8i card with no luck so far. I also have an LSI 9220 8i that am going to test with next.

Legg igjen en kommentar

Fyll inn i feltene under, eller klikk på et ikon for å logge inn:

Du kommenterer med bruk av din konto. Logg ut /  Endre )


Du kommenterer med bruk av din Twitter konto. Logg ut /  Endre )


Du kommenterer med bruk av din Facebook konto. Logg ut /  Endre )

Kobler til %s