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.

azev

Well-Known Member
Jan 18, 2013
773
253
63
Zoli, do you have a HBA adapter ?? if you do you might want to check and see if the sector size are supported.
 

R.Zoli

Member
Sep 5, 2015
52
3
8
22
Zoli, do you have a HBA adapter ?? if you do you might want to check and see if the sector size are supported.

What kind of hba card do you think about? I have an LSI 9270 and a Adaptec 71605, and the onboard x99 sata3 ports... That's the all what I have. What I need? Thanks for the reply!
 

azev

Well-Known Member
Jan 18, 2013
773
253
63
You need a non raid HBA SAS adapter like LSI9211 or its other twin brother and sisters :)
I am not sure if raid if you can reformat or check the sector size using raid adapter.
 

R.Zoli

Member
Sep 5, 2015
52
3
8
22
You need a non raid HBA SAS adapter like LSI9211 or its other twin brother and sisters :)
I am not sure if raid if you can reformat or check the sector size using raid adapter.
It sucks... If the card can not initialize the drive and i can not manage an array with the drive,then it's possible that I can see under linux with sg tools the drive? I asked only that I haven't got too much time now so if it is not possible then I rather find a hba card on ebay and not wasting time with this adapters....
 

R.Zoli

Member
Sep 5, 2015
52
3
8
22
You need a non raid HBA SAS adapter like LSI9211 or its other twin brother and sisters :)
I am not sure if raid if you can reformat or check the sector size using raid adapter.

I read the system logs after I entered emergency mode. The only thing what could be important:

localhost kernel:scsi 1:1:2:0: Direct-Access Hitachi SLR5A-S400SS ABAB PQ: 1 ANSI: 6

That could be mean if I can somehow install sg3_utils then I will see the drive and I can format is?

Can I install sg3_utils in emergency mode?
 

azev

Well-Known Member
Jan 18, 2013
773
253
63
I would say give it a try and see if you can first identify that the drive do have an offset sector size.
If so then I would try re-formating with sg3_utils with raid controller attached.
However this will be a complete untested process, do it at your own risk. I've done this multiple time with LSI9211 card successfully (both spinners and SSD).
 

R.Zoli

Member
Sep 5, 2015
52
3
8
22
I would say give it a try and see if you can first identify that the drive do have an offset sector size.
If so then I would try re-formating with sg3_utils with raid controller attached.
However this will be a complete untested process, do it at your own risk. I've done this multiple time with LSI9211 card successfully (both spinners and SSD).

In ubuntu the sg_info says permission denied on sg0 and sg1 devices...
In the log file I can not find that the drive has incorrect sector size, only this what I wrote:
Dec 21 00:10:17 zoli-All-Series kernel: [ 6.110270] scsi 0:1:2:0: Direct-Access HITACHI SLR5A-S400SS ABAB PQ: 1 ANSI: 6
 

R.Zoli

Member
Sep 5, 2015
52
3
8
22
I would say give it a try and see if you can first identify that the drive do have an offset sector size.
If so then I would try re-formating with sg3_utils with raid controller attached.
However this will be a complete untested process, do it at your own risk. I've done this multiple time with LSI9211 card successfully (both spinners and SSD).

Ok. It works now :) This is awesome!

I tell my expreiences.

It's a HP branded HUSSL4040ASS drive. It worked with NOTHING before the sg3utils format!
It was weird that the sg-can did not give any info of the drive, I saw only that the drive is the sg0 device.
Sg_format give me the info before the format that the unit has 520 byte sector size... And after the format I CAN USE IT WITH ANYTHING!!!!! Thanks for everyone :)
 
  • Like
Reactions: T_Minus

R.Zoli

Member
Sep 5, 2015
52
3
8
22
For those of you who have purchased OEM rebranded HDD or SSD from major storage vendor such as NetApp, EMC, or even HP, you might find out that the drive that you've purchased will not initialized in windows. The main reason is that the drive come formatted from the factory with a non standard sector size of 520B or 528B, and windows refused to initialized drive other than the normal 512B or 4Kb. I read online the reason that these drive are formatted that way is due to some proprietary software that these vendor uses needs the additional sector size for some fancy parity stuff.

Anyway, you probably think that you are SOL after trying every possible means to use the drive.
Luckily there is a way to change the drive sector back to 512B. It require that you install centOS linux and follow the instruction below

Look in /var/log/messages after reboot, and you will see useful information:

Mar 9 08:08:54 vhc-carthage kernel: sd 6:0:7:0: [sdh] Attached SCSI disk
Mar 9 08:08:57 vhc-carthage kernel: ...ready
Mar 9 08:08:57 vhc-carthage kernel: sd 6:0:8:0: [sdi] Unsupported sector size 520.
Mar 9 08:08:57 vhc-carthage kernel: sd 6:0:8:0: [sdi] 0 512-byte logical blocks: (0 B/0 B)
Mar 9 08:08:57 vhc-carthage kernel: sd 6:0:8:0: [sdi] 520-byte physical blocks
Mar 9 08:08:57 vhc-carthage kernel: sd 6:0:8:0: [sdi] Write Protect is off
Mar 9 08:08:57 vhc-carthage kernel: sd 6:0:8:0: [sdi] Write cache: disabled, read cache: enabled, supports DPO and FUA
Mar 9 08:08:57 vhc-carthage kernel: sd 6:0:8:0: [sdi] Unsupported sector size 520.
Mar 9 08:08:57 vhc-carthage kernel: sd 6:0:8:0: [sdi] Attached SCSI disk

# yum install sg3_utils

# sg_scan -i
/dev/sg8: scsi6 channel=0 id=7 lun=0
NETAPP X287_S15K5288A15 NA00 [rmb=0 cmdq=1 pqual=0 pdev=0x0]
/dev/sg9: scsi6 channel=0 id=8 lun=0
NETAPP X287_S15K5288A15 NA00 [rmb=0 cmdq=1 pqual=0 pdev=0x0]

Now you should format the offending drive using the "sg_format" command.
[root@azev /]# sg_format --format --size=512 /dev/sg8

NETAPP X287_S15K5288A15 NA00 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

It is pretty simple, and after the format is completed, you should have no problem initializing the drive in Windows. However, per Patrick, some drive might require that you've bring the drive offline and then online before it would allow you to format it.

Some people argue that the custom firmware on the drive is set to work with sector size 520B or 528B, but during my benchmark, the drive performance was pretty much on par with the normal retail channel.

Hopefully you find this information useful next time you come across a drive with other than 512B sector size.
I've made some benchmark under linux and the performance is the same as my other non-HP Hitachi HUSSL4040ASS drives.... So it's true, the performance on par with normal drives :)
 
  • Like
Reactions: T_Minus

R.Zoli

Member
Sep 5, 2015
52
3
8
22
Congrats, glad the guide works for you :)
Today I made the same formatting to my second HP drive and that's working fine too :)

Another big experience that I always used LSI RAID Cards but I buyed an adaptec 71605. As I use the adaptec card I think it's a lot better and usable card than my LSI 9270 card. The two RAID bios is incomparable. The 71605 has far far better BIOS, more options (like the HBA mode what was very usable) , easier configurable.
I had more compatibility issues with the LSI card in an Asus x79 board, the Adaptec never had compatibility problems... This is just my experiences :)
 

Patriot

Moderator
Apr 18, 2011
1,470
801
113
I would hold your judgement till you test SSD performance on the adaptec cards...
 

T_Minus

Build. Break. Fix. Repeat
Feb 15, 2015
7,762
2,141
113
Well, I just got in a 12Gb/s SAS 200GB HGST card with HP firmware/version.... exactly as I wanted, to go with the other 2 matching I have. However, it's not being detected in Windows10 at all. I tested the other 2 (identical) drives, they hot-swap just fine are detected right away... this new one, nada, nothing.... same version firmware too it claims.

Guess I'll be booting up linux next to see if I can learn anymore. (Testing on a M1015 HBA -- Will throw in my LSI 12Gb/s Intel RAID card, and LSI 12Gb/s HBA next to see if any differences.)
 

R.Zoli

Member
Sep 5, 2015
52
3
8
22
I would hold your judgement till you test SSD performance on the adaptec cards...
Same performance as the LSI card...My only problem is that I don't know how to refresh the firmware on my HGST drives. These drives with HP firmware is not so good in random writes, with a newer HGST firmware would be better , but I didn't find any software for the firmware upgrade... Any idea or someone made anytime firmware update on HGST HUSSL4040ASS drive or on anything similar drive?
 

IamSpartacus

Well-Known Member
Mar 14, 2016
2,520
652
113
Finally got around to formatting my Hitachi HUSSL4040ASS drives. This made it super simple. Thanks!
 

whitey

Moderator
Jun 30, 2014
2,766
868
113
42
Another hussl4010bss drive rescued that was previously unusable in FreeNAS (gpt label/format error). All good after sg3-utils format. woohooo
 
  • Like
Reactions: T_Minus

T_Minus

Build. Break. Fix. Repeat
Feb 15, 2015
7,762
2,141
113
I have 10 in my mailbox I need to do... :) oh the fun, hopeflly go smooth for me, my 1st time doing 520>512
 

nthu9280

Well-Known Member
Feb 3, 2016
1,630
504
113
San Antonio, TX
@azev I'm getting the following error when trying to format Hitachi 2TB SATA drives (HUA723020ALA641).

The drives are not protected. 4 on Dell H310 flashed with latest P20 IT FW and one directly on SATA port on the MB. All of them exhibit same error. Tried with both --fmtpinfo=0 & 1 to no avail. I'd really appreciate any help.

Code:
[root@centos7-01 Hitachi]# sg_readcap -l /dev/sda
Read Capacity results:
   Protection: prot_en=0, p_type=0, p_i_exponent=0
   Logical block provisioning: lbpme=0, lbprz=0
   Last logical block address=3907029167 (0xe8e088af), Number of logical blocks=3907029168
   Logical block length=512 bytes
   Logical blocks per physical block exponent=0
   Lowest aligned logical block address=0
Hence:
   Device size: 2000398934016 bytes, 1907729.1 MiB, 2000.40 GB

Code:
root@centos7-01 Hitachi]# sg_format --format --fmtpinfo=0 -v /dev/sda
    inquiry cdb: 12 00 00 00 24 00
    ATA       Hitachi HUA72302  A840   peripheral_type: disk [0x0]
      PROTECT=0
    mode sense (10) cdb: 5a 00 01 00 00 00 00 00 fc 00
    mode sense (10): pass-through requested 252 bytes but got 28 bytes
Mode Sense (block descriptor) data, prior to changes:
  Number of blocks=0 [0x0]
  Block size=512 [0x200]

A FORMAT will commence in 10 seconds
    ALL data on /dev/sda will be DESTROYED
        Press control-C to abort
A FORMAT will commence in 5 seconds
    ALL data on /dev/sda will be DESTROYED
        Press control-C to abort
    format cdb: 04 18 00 00 00 00
format unit:  Fixed format, current;  Sense key: Illegal Request
Additional sense: Invalid field in cdb
Format command, illegal parameter
FORMAT failed
 

T_Minus

Build. Break. Fix. Repeat
Feb 15, 2015
7,762
2,141
113
1st drive from ebay;

Format in progress, 63.97% done
Format in progress, 66.82% done
Format in progress, 69.60% done
WARNING: Your hard drive is failing
Device: /dev/sda, failed to read SMART values

Format in progress, 72.45% done
Format in progress, 75.23% done

:mad:

Does that occur if the format takes long and it does a test in the middle?
I checked SMART Info and it looks fine (after format)...
 
Last edited:
  • Like
Reactions: ( )

Terry Kennedy

Well-Known Member
Jun 25, 2015
1,143
596
113
New York City
www.glaver.org
Does that occur if the format takes long and it does a test in the middle?
I checked SMART Info and it looks fine (after format)...
I haven't seen that on a regular controller / drive combo, but I have seen it on RAID controllers with command passthru. Subsequent attempts seem to work fine.

If the SMART data looks OK (you could post it for confirmation) I'd say the drive is fine.