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.

JustinH

Active Member
Jan 21, 2015
124
76
28
49
Singapore
I saw the smart warning while doing sg_format. I think it's due to the drive being busy and timing out the smart Daemon running in the background.


Sent from my iPhone using Tapatalk
 

T_Minus

Build. Break. Fix. Repeat
Feb 15, 2015
7,763
2,142
113
I saw the smart warning while doing sg_format. I think it's due to the drive being busy and timing out the smart Daemon running in the background.


Sent from my iPhone using Tapatalk
That's what I was hoping! Marked drive, will keep eye on it.
 

Terry Kennedy

Well-Known Member
Jun 25, 2015
1,143
596
113
New York City
www.glaver.org
Thanks @Terry Kennedy
I ran a LONG smart test, to me it looks fine but there's not much info provided in smart.
smartmontools isn't very verbose when talking to SAS drives. But the good/bad status that a SAS drive reports about itself is probably more reliable than the same info from a SATA drive (I've had lots of SATA drives report "I'm fine" in their SMART data while at the same time reporting fatal I/O errors to the host).
I posted results in my other thread to prevent clogging this one up any further:
HGST SLC vs MLC -- Weirdness
I didn't know it was a SSD. They tend to have vendor-specific SMART extensions. If it is a non-OEM drive you may be able to find information on them from the manufacturer's web site. If it is an OEM drive, things probably don't work the same.
 

T_Minus

Build. Break. Fix. Repeat
Feb 15, 2015
7,763
2,142
113
@Terry Kennedy -- Yep, it's an HP.

Guess with the # of HP-based SSD I have now should get a HBA that can read the info 100%
 

istqian

New Member
Jun 9, 2016
14
14
3
Fukuoka, Japan
I successfully reformat 7 HP rebrand HUSML4040ASS601 400GB SSDs from 520 sector to 512 sector as descript here.

I use FreeBSD 11 current and sg_utils from ports.

At first I was using DELL H200 HBA(IT firmware). and HBA report error on init the SDDs.
so I cannot reformat them.

after that, I connect these SSDs to a LSI 1068E HBA, with IT mode firmware, and HBA can regonize them!
after that, things runs smoothly.

so if your HBA cannot recognize 520 sector SSD/HDD, you can try other HBAs, don't give up.

Thanks!
 
  • Like
Reactions: Patrick

felmyst

New Member
Mar 16, 2016
27
6
3
28
You can also do the same from Windows. Just download pre-compiled Windows binaries from The sg3_utils package
Notice: you'll need recent versions (2012 and higher I believe) for it to work.
The only difference from Linux version is drive naming: instead of /dev/sdX you'll have PD# (stands for PhysicalDisk#, you can get them using PowerShell cmdlet Get-PhysicalDisk or using sg_scan)
 

jacobwilliam

New Member
Aug 9, 2016
3
0
1
38
You can't change the sector size of a hard drive - the sectors are created when the hard drive is manufactured and can't be changed.

You can change the NTFS cluster size (also called the "allocation unit size") of the file system using Disk Manager as shown by nikorr, but you have to reformat to do it. Using a smaller cluster size may result in a more fragmented disk and slower performance.
 

felmyst

New Member
Mar 16, 2016
27
6
3
28
You can't change the sector size of a hard drive - the sectors are created when the hard drive is manufactured and can't be changed.

You can change the NTFS cluster size (also called the "allocation unit size") of the file system using Disk Manager as shown by nikorr, but you have to reformat to do it. Using a smaller cluster size may result in a more fragmented disk and slower performance.
That's because it should be called "block size" and not "sector size". Sectors are created when HDD is manufactured, blocks are defined by controller. Many "enterprise" drives come with an option to enable T10 Data Integrity Field which makes them 520b block size. This thread explains how to disable this feature thus making these drives common 512b block size disks.
BTW, sector size, block size? Who cares? We need to change "520 something" to "512 something". It works.
 

Vodokotlic

New Member
Sep 28, 2015
10
2
3
41
My customer has an old Data Direct Network storage who accepts only 520 block size disks.

Edit: It is FC version. Never mind :)
 

ZeeLog

New Member
Aug 22, 2016
1
0
1
50
I just need to hook up a SAS drive (2.5") with an HBA SAS LSI9211 controller.
can anyone please recommend which SAS cable I have to look for?
Is it the SFF8087 to SFF8482 cable?
Thanks :)
 

jopi

New Member
Aug 22, 2016
4
0
1
68
Hi all out there,
I'm glad to have second of eight 520B formatted SAS drives >2TB reformatting to 512B sectors right now.
Even if it lasts more than one week to do all the drives, starter of this tread was the first one who told me a real way to go.
So thank you very much, azev.
For those, who ask about controller: I have a "rebranded" (formally DELL) LSISAS2008 running in IT mode (i.e. HBA only), which is able to support at least upto 4TB drives. Larger drives I don't have to test it with...
Re the drives coming with other sector sizes than 512B: As I can see for the moment, by using centOS and sg_format I at least could invoke reformatting without cancel from the start. Only for finishing, I still have to wait some 16 hours for my 4TB drive to finish...
So lots of time to answer cable questions.
What I'm using at the moment, is a fan-out cable from mini-SAS to 4 SAS drives with separate SATA power connectors, labeled:
CBL-00070-20-A-R A
FP36K81-14-0F
Cable works as expected. I.e. fine. At least with 3Gbps, which is enough for controller. And drives.
So far for the moment,
CU
 

eNkrypt

New Member
Sep 1, 2016
2
0
1
33
I have used this method in the past a ton and it has worked. However I have run into a problem with some new drives I have received. I am trying to change the block size of some disks I received from an auction but I can't use them because they are formatted with a block size of 520. No big deal, in the past all I have had to do is use sg_util (sg_format) to change the block size from 520 to 512. However, for these particular Samsung SSD drives it doesn't appear to work.

Here are the errors I am getting:

DMESG
[ 3988.000410] sd 11:0:0:0: Attached scsi generic sg7 type 0
[ 3988.000414] sd 11:0:0:0: [sdg] Unsupported sector size 520.
[ 3988.000418] sd 11:0:0:0: [sdg] 0 512-byte logical blocks: (0 B/0 B)
[ 3988.000420] sd 11:0:0:0: [sdg] 520-byte physical blocks
[ 3988.000507] sd 11:0:0:0: [sdg] Write Protect is off
[ 3988.000510] sd 11:0:0:0: [sdg] Mode Sense: 00 3a 00 00
[ 3988.000532] sd 11:0:0:0: [sdg] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 3988.000676] sd 11:0:0:0: [sdg] Unsupported sector size 520.
[ 3988.000759] sd 11:0:0:0: [sdg] Attached SCSI disk
Format Command
# sg_format -v --format --size=512 /dev/sdg
ATA SS160511 4C3Q peripheral_type: disk [0x0]
PROTECT=0
Unit serial number: XXXXXXX
LU name: XXXXXXXXX
mode sense (10) cdb: 5a 00 01 00 00 00 00 00 fc 00
Mode Sense (block descriptor) data, prior to changes:
Number of blocks=0 [0x0]
Block size=512 [0x200]
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 request sense key, apart from Invalid opcode
FORMAT failed
Scan Command
# sg_scan -i
/dev/sg0: scsi0 channel=0 id=0 lun=0 [em]
ATA SAMSUNG HD322GJ 0001 [rmb=0 cmdq=0 pqual=0 pdev=0x0]
/dev/sg1: scsi1 channel=0 id=0 lun=0 [em]
ATA ST3250820AS G [rmb=0 cmdq=0 pqual=0 pdev=0x0]
/dev/sg2: scsi4 channel=0 id=0 lun=0 [em]
ASUS DRW-24B1ST i 1.00 [rmb=1 cmdq=0 pqual=0 pdev=0x5]
/dev/sg3: scsi8 channel=0 id=0 lun=0 [em]
ATA Samsung SSD 850 1B6Q [rmb=0 cmdq=0 pqual=0 pdev=0x0]
/dev/sg4: scsi12 channel=0 id=0 lun=0 [em]
Kingston DataTraveler 2.0 PMAP [rmb=1 cmdq=0 pqual=0 pdev=0x0]
/dev/sg5: scsi9 channel=0 id=0 lun=0 [em]
ATA ST2000DM001-1CH1 CC24 [rmb=0 cmdq=0 pqual=0 pdev=0x0]
/dev/sg6: scsi10 channel=0 id=0 lun=0 [em]
ATA ST95005620AS SD28 [rmb=0 cmdq=0 pqual=0 pdev=0x0]
/dev/sg7: scsi11 channel=0 id=0 lun=0 [em]
ATA SS160511 4C3Q [rmb=0 cmdq=0 pqual=0 pdev=0x0]
The host machine that is running these commands is Ubuntu 16.

Any help would be greatly appreciated!

Regards
 

eNkrypt

New Member
Sep 1, 2016
2
0
1
33
I could not use sg_format on SATA. Is the SSD you are trying SAS or SATA?

Sent from my Nexus 6 using Tapatalk
It is a Samsung SSD branded by EMC - They had a SAS to SATA converter on them, I took it off so I could plug these into my computer. So to answer your question they are SATA. I am thinking that the EMC Firmware they have on them does not support 512 block sizes. Perhaps I can flash a new firmware. Anyone know of a way?
 

fractal

Active Member
Jun 7, 2016
309
69
28
33
so if your HBA cannot recognize 520 sector SSD/HDD, you can try other HBAs, don't give up.
I picked up a couple of 15K SAS drives for fun. I connected them to a LSI 9240-8i with a SFF8087 to SFF8482 cable that I found in the junk box. I think the cable came with the Dell H310's I bought a while ago.

I can see the drives in the bios utility but they are not presented to the OS and sg_scan doesn't see them.

So, I swapped out the LSI 9240 for a Dell H310 that was flashed to LSI IT mode without a BIOS and was able to see them. The instructions from this thread worked great. dmesg saw them as 520 but I was able to reformat them 512 as expected. It took less than an hour to format a 450GB drive.

Thanks for the very helpful post.
 

jopi

New Member
Aug 22, 2016
4
0
1
68
@eNkrypt:

As 520 bytes per sector is no valid SATA format, I don't think that you will find any SATA controller, that accepts your EMC/Samsung SSDs. AFAIS the only chance is to reformat them via a SAS controller and the SAS-to-SATA bridge, that you took off. BTW I was not successful to reformat my 520 bytes per sector TB hard drives (non-SSD) with a debian Linux - and Ubuntu is debian based - even after I had my Dell LSI2008 rebranded, and latest LSI IT mode BIOS was able to see them. And BTW2 my drives were EMC like yours.

Best regards