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.

amp88

Member
Jul 9, 2020
59
63
18
Looking over the posts a few have referred to setblocksize but I see no package in both debian or in rhel systems that will allow this install. setblocksize -b512 -t1200 /dev/sg0 if run does nothing as the package does not exist.
The instructions on how to download, compile, and run setblocksize are here on github. That's the guide I successfully used ~3 years ago on a bunch of drives in an EMC KTN-STL3 enclosure.
 

itronin

Well-Known Member
Nov 24, 2018
1,296
861
113
Denver, Colorado
I seem to be having this same problem when trying to convert the 520 to 512 (can do 4096 per drive sticker too)

Get a Protected Error message when attempt to format 520 to clear data

Code:
sg_format --format --size=520 -v -e /dev/sda
    NETAPP    X317_SMBPE06TA07  NA00   peripheral_type: disk [0x0]
      PROTECT=0
      Unit serial number: ZAD2KJTW
      LU name: 5000c50094bfb1db
    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=11521787400 [0x2aec08608]
  Block size=520 [0x208]

A FORMAT UNIT will commence in 15 seconds
    ALL data on /dev/sda will be DESTROYED
        Press control-C to abort

A FORMAT UNIT will commence in 10 seconds
    ALL data on /dev/sda will be DESTROYED
        Press control-C to abort

A FORMAT UNIT will commence in 5 seconds
    ALL data on /dev/sda will be DESTROYED
        Press control-C to abort
    Format unit cdb: [04 18 00 00 00 00]
Format unit:
Descriptor format, current; Sense key: Data Protect
Additional sense: Access denied - no access rights
  Descriptor type: Information: 0x0000000000000000
  Descriptor type: Field replaceable unit code: 0x0
  Descriptor type: Vendor specific [0x80]
    00 00 00 00 00 20 00 00 00 00 00 00 00 00
Format unit command: Data protect, type: sense key; write protected media?
FORMAT UNIT failed
Does not even start when trying to format direct to 512 (same with 4096)

Code:
sg_format --format --size=512 -v -e /dev/sda
    NETAPP    X317_SMBPE06TA07  NA00   peripheral_type: disk [0x0]
      PROTECT=0
      Unit serial number: ZAD2KJTW
      LU name: 5000c50094bfb1db
    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=11521787400 [0x2aec08608]
  Block size=520 [0x208]
    mode select(10) cdb: [55 11 00 00 00 00 00 00 24 00]
mode select(10):
Descriptor format, current; Sense key: Data Protect
Additional sense: Access denied - no access rights
  Descriptor type: Information: 0x0000000000000000
  Descriptor type: Field replaceable unit code: 0x0
  Descriptor type: Vendor specific [0x80]
    00 00 00 00 00 20 00 00 00 00 00 00 00 00
MODE SELECT command: Data protect, type: sense key; write protected media?
Results are same if use /dev/sda or /dev/sg0 for dive up until last drive on list.
sg_format -v --format --six --size=512 /dev/sda and sg_format -v --format --six --size=520 /dev/sda both give same results as above.

Looking over the posts a few have referred to setblocksize but I see no package in both debian or in rhel systems that will allow this install. setblocksize -b512 -t1200 /dev/sg0 if run does nothing as the package does not exist.




When sg_sanitize -B -v /dev/sg0 is run this is the output.


Code:
sg_sanitize -B -v /dev/sg0
    NETAPP    X317_SMBPE06TA07  NA00   peripheral_type: disk [0x0]
      PROTECT=0
      Unit serial number: ZAD2KJTW
      LU name: 5000c50094bfb1db

A SANITIZE will commence in 15 seconds
    ALL data on /dev/sg0 will be DESTROYED
        Press control-C to abort

A SANITIZE will commence in 10 seconds
    ALL data on /dev/sg0 will be DESTROYED
        Press control-C to abort

A SANITIZE will commence in 5 seconds
    ALL data on /dev/sg0 will be DESTROYED
        Press control-C to abort
Sanitize:
Descriptor format, current; Sense key: Illegal Request
Additional sense: Invalid field in cdb
  Descriptor type: Sense key specific: Field pointer:
        Error in Command: byte 1 bit 4
  Descriptor type: Field replaceable unit code: 0x1
  Descriptor type: Vendor specific [0x80]
    00 00 00 00 ff 20 00 00 00 00 00 00 00 00
Sanitize failed: Illegal request, type: sense key, apart from Invalid opcode

Their is also a reference to sedutil-cli but again not seeing the program on any repo.


As with everyone here no data on the drives just tying to remove the 520 byte sectors so that the drive can be made useful
before you go down too far in your current rabbit hole make sure they drive wasn't formatted with some sort of protection enabled.

you might look here and at a minimum do a smartctl -i /dev/sg0 and see what the output is.

reference


see if something similar to this appears in the smartcli output: "Formatted with type 2 protection"
 

citizen

New Member
Dec 1, 2020
13
2
3
Status Update

Thank you itronin
make sure they drive wasn't formatted with some sort of protection enabled.
While I did find out another way this was on the correct track of my original post on the problem. Even though my read out said encryption level 0 this must be a level with in the drive. They would not work until did Seatools secure erase.

Had I seen your referenced post this may have been a better way. But sadly did not see until after finding data on the seatools work around but the concept is the same and may have been better then trying an random 32 digit number per drive for 24 drives

I found a post citing seatools to secure erase and sanitize the drives this was done with a quick secure erase using each drives 32 digit code that should be barcoded but understand why it is not
after the long sanitize of the drives I tried again to SG_Format to 512 (Still fails at 4096 common and no big deal) 30 hours later 22 of the 24 drives have been formatted to 512
Getting a Media Error on 2 of the drives (may have to call them bad) but once traced the two via serials numbers am doing a second sg_format on them now but one of the drives failed ~75% though and not sure on the other as terminal connection lost on that window due to this will not now for a day or so more.

Other thoughts - seatools has a low level format for sectors why does it only allow "Current" instead of including 512, 520, 528, ... sector sizes (Yes the answer is seagate but still they make the drives the sector and the formatting software why not add this one line of code)

For those who choose the seatools way

Seatools works with live disk, linux, and windows.
I used windows for no reason (then closest computer with sas that could be rebooted with no downtime)
installed seatools
once opened seatools sall all drives and could show drive details with no issue.
it would see all drives but any format, sanitize, modify in any way would fail
when to advanced choose one drive (can only start this action on 1 drive at a time but nothing stops you from going to next drive once started)
short > second option
Popup asks for the 32 digit secure erase code (note if not sure if is a O or 0 always put the 0 (number) and B and 8 just like windows xp look almost same)
choose drive again and start format
if you did the short this takes 10 -30 seconds (Can be done in long but i did not try this)
I followed with a Long Sanitize of each drive 6tb drives are about 1tb/hr came back in 8 hours
Drives all finished with no errors reported
switched back to linux and did

Code:
sg_format -v --format --size=512 /dev/sg##
on all drives 24 hours later 22 of 24 up and redoing the remaining 2 after their fails
 

Jannis Jacobsen

Active Member
Mar 19, 2016
367
80
28
46
Norway
I tried to change a DOPE1920S5xnNMRI drive today from 520 to 512 with sg_format:
sg_format --format --size=512 --six -v /dev/sg15

I got the same as the forum user on page 4:

Format unit has started
Format in progress, 39.08% done
Format in progress, 81.75% done
FORMAT UNIT Complete
(The entire format just took a couple of minutes).

But after this the drive is invisible to the system.
I've removed it waited a bit and inserted it back.
The light on the drive caddy lights up as normal, but the os cannot see the drive anymore.
(Truenas Scale).

It looks like it's been bricked, but I can't see why?

Has anyone experienced this before?

-j
 

ponky

New Member
Nov 16, 2015
19
7
3
What is the reason behind everyone suggesting a format to 512 instead of 4096 sectors? If the actual size of IO is 4k (Physical block, the size of writes/reads the disk will do to the platter), wouldn't it make sense to just format to 4k with sg_utils?

Just grabbed bunch of HC510's from two different sources. All formatted to 512. They have firmwares NE01and H925, guessing NetApp and Fujitsu.

NE01 drives have DCO reporting:

Code:
Real max sectors: 1
and HPA:
Code:
 max sectors = 0/513, HPA is enabled
They also seem to report different sector counts:
Code:
Disk /dev/sdn: 8.91 TiB, 9796820402176 bytes, 19134414848 sectors
Disk model: HUH721010AL5204

Disk /dev/sdm: 9.1 TiB, 10000831348736 bytes, 19532873728 sectors
Disk model: HUH721010AL5204
I've tried disabling DCO and HPA with --dco-restore but does not seem to work. Any tips on this?

Would it make sense to flash these to matching firmware?
 

i386

Well-Known Member
Mar 18, 2016
4,411
1,638
113
35
Germany
What is the reason behind everyone suggesting a format to 512 instead of 4096 sectors?
Because the original post was about devices that came formatted with 520 Byte sectors (512 Byte data + 8 Byte parity/"meta" data).
512 or 4096 Bytes are both "good"
 

mrpasc

Well-Known Member
Jan 8, 2022
581
324
63
Munich, Germany
And, lot of those older enterprise SAS SSDs go into ESXi homelabs, thus need to be 512B to be used as storage if not used with hardware raid controller.
 
  • Like
Reactions: i386

ponky

New Member
Nov 16, 2015
19
7
3
Because the original post was about devices that came formatted with 520 Byte sectors (512 Byte data + 8 Byte parity/"meta" data).
512 or 4096 Bytes are both "good"

Is there something preventing to format from 520 to 4096? How I understand this, even the 520b drives report physical sectors as 4k, which is the actual IO size the disk does from firmware to the platter. So formatting to 512 would mean that any 4k write from OS goes to disk firmware as is and the firmware then splits it to 4x 512b IOs? This would explain why some people report OEM drives running hot after 512 format.
 

Terry Kennedy

Well-Known Member
Jun 25, 2015
1,143
596
113
New York City
www.glaver.org
And, lot of those older enterprise SAS SSDs go into ESXi homelabs, thus need to be 512B to be used as storage if not used with hardware raid controller.
I've been running 4Kn format drives here since early 2016 on a SAS2008 controller with P20 firmware. They can't be used as boot devices in BIOS mode (UEFI mode should work). I've always run FreeBSD on those boxes, but Microsoft says 4Kn is supported from Windows 8 onward.
 
  • Like
Reactions: itronin

Jamitin

New Member
Feb 28, 2024
2
2
3
Greetings,

Hope everyone is well. I recently purchased 4 drives for a Dell Poweredge R720 that are coming up as blocked in the SAS H710 utility. I bought 2TB Seagate ST32000444SS drives to match a set of 4 I already had. I popped the new drives in, and it will not let me do anything in the utility. It just shows blocked. The old drives I have that are the same model number are working and show READY. A couple of searches later and I wind up on this post.

What I want to know is can this Linux command to format these drives through the PERC hardware controller? I have loaded a Windows Server boot disk, and CentOS 8 installer, and both show no drives. So I am thinking that the controller is not presenting these drives to the OS.

I can pop a known working disk to install Linux on the R720 and try the command anyway, but I fear that the controller will not pass the format onto drives that it isn't seeing.

Or I can use a workstation class, software SAS card on a desktop machine. Perhaps this is the better idea, to avoid the complexity of the Dell storage system?

I am just not sure this format will solve my issue.

I did see other posts about updating the firmware on the SAS controller to get it to read the newer drives. The firmware is up-to-date, and it reads the old drives 2TB with no complaints.

Attached is my issue. The interesting thing is that the controller reads the model number as something different that the label. The one marked READY is the operational one, the BLOCKED one is the new unit. What ever vendor that changed this firmware, seems to have just dumped half the model number and put in CLAR2000. I am not sure where these were pulled from.

Any and all help is appreciated.

-Cheers!

IMG_1267.jpgIMG_1269.jpg
 
  • Like
Reactions: Samir

citizen

New Member
Dec 1, 2020
13
2
3
I would check sea tools and do a wipe on them with the sec codes on the cover also use SG tools to see sector size custom firmware most of the time means used in a proprietary system
 
  • Like
Reactions: Samir

bandit8623

Member
May 25, 2021
63
20
8
Greetings,

Hope everyone is well. I recently purchased 4 drives for a Dell Poweredge R720 that are coming up as blocked in the SAS H710 utility. I bought 2TB Seagate ST32000444SS drives to match a set of 4 I already had. I popped the new drives in, and it will not let me do anything in the utility. It just shows blocked. The old drives I have that are the same model number are working and show READY. A couple of searches later and I wind up on this post.

What I want to know is can this Linux command to format these drives through the PERC hardware controller? I have loaded a Windows Server boot disk, and CentOS 8 installer, and both show no drives. So I am thinking that the controller is not presenting these drives to the OS.

I can pop a known working disk to install Linux on the R720 and try the command anyway, but I fear that the controller will not pass the format onto drives that it isn't seeing.

Or I can use a workstation class, software SAS card on a desktop machine. Perhaps this is the better idea, to avoid the complexity of the Dell storage system?

I am just not sure this format will solve my issue.

I did see other posts about updating the firmware on the SAS controller to get it to read the newer drives. The firmware is up-to-date, and it reads the old drives 2TB with no complaints.

Attached is my issue. The interesting thing is that the controller reads the model number as something different that the label. The one marked READY is the operational one, the BLOCKED one is the new unit. What ever vendor that changed this firmware, seems to have just dumped half the model number and put in CLAR2000. I am not sure where these were pulled from.

Any and all help is appreciated.

-Cheers!

View attachment 35029View attachment 35030
need hba and use sg_format to 512 byte sector. cant use raid card to do it. drives likely 4k or 520 byte sector. 710 cant do 4k.
https://www.reddit.com/r/homelab/comments/vcjrc9
 
  • Like
Reactions: Samir

Whaaat

Active Member
Jan 31, 2020
362
190
43
Attached is my issue. The interesting thing is that the controller reads the model number as something different that the label. The one marked READY is the operational one, the BLOCKED one is the new unit. What ever vendor that changed this firmware, seems to have just dumped half the model number and put in CLAR2000. I am not sure where these were pulled from.
your drives come from EMC Clariion storage and formatted with 520bps - you can tell this from the difference in size 1862 GB vs 1833 GB. You'll need an hba to reformat and reflash drives to stock firmware as described here
 
  • Love
Reactions: Samir

Sean Ho

seanho.com
Nov 19, 2019
822
384
63
Vancouver, BC
seanho.com
Are you using the H710 for hardware RAID? Pop the drives onto an HBA (or a RAID card flashed to IT) to sg_format to 512 or 4k, then move the drives back to the R720, and the H710 should see them. If using the HBA doesn't show the block devs under the OS, try the SCSI generic devices (/dev/sg* under Linux; use lsscsi -g to show).

The H710 (2208) handles 4k just fine with LSI firmware, either IR or IT. It can even boot off a 4kn drive, unlike 2008-based cards.
 
  • Like
Reactions: Samir

Jamitin

New Member
Feb 28, 2024
2
2
3
Thanks everyone for the replies!

When you say pop it into a HBA and re-flash it, do you mean an external drive array? Can I just use a SAS card I have laying around like this:

PERC H200

or

RAID 6/IR SAS

Then run the SeaTools from Windows?
 
  • Like
Reactions: Samir

Samir

Post Liker and Deal Hunter Extraordinaire!
Jul 21, 2017
3,568
1,674
113
49
HSV and SFO
Thanks everyone for the replies!

When you say pop it into a HBA and re-flash it, do you mean an external drive array? Can I just use a SAS card I have laying around like this:

PERC H200

or

RAID 6/IR SAS

Then run the SeaTools from Windows?
No, it can't be a raid card but one that operates in 'initiator target' mode aka IT mode. This is a straight sas drive controller without raid. (There are ways to cross flash the raid cards to IT mode but the risk is bricking the card. There are also some cards that have an option for raid or IT mode, but they're usually newer and more expensive than just a straight sas it mode card.)