How to reformat HDD & SSD to 512B Sector Size

Vodokotlic

New Member
Sep 28, 2015
9
2
3
37
I have some Hitachi HUA721010KLA330. I run sg_format to 520. Unfortunately my colleague stopped formatting by accident. Now the hard drive is useless and it is show only 4Gb capacity. Any suggestion how to rescue the hard drive?
 

Samir

Well-Known Member
Jul 21, 2017
1,306
375
83
45
For those that are having trouble formatting to 512k, have you tried to format to 4k? It would be interesting if the drives that fail at 512 would work at 4096.

Another idea is this software I ran across that supposedly can remove 'bios locks' as part of a sanitization process:
Hard Drive & Disk Eraser Software - Blancco
 

Samir

Well-Known Member
Jul 21, 2017
1,306
375
83
45
I have some Hitachi HUA721010KLA330. I run sg_format to 520. Unfortunately my colleague stopped formatting by accident. Now the hard drive is useless and it is show only 4Gb capacity. Any suggestion how to rescue the hard drive?
I would simply try the command again and see what happens.
 

Sleyk

Well-Known Member
Mar 25, 2016
1,007
393
83
Stamford, CT
Hello friends!

I recently came into a set of 100GB SAS HP 3PAR ssd's. I wanna use 'em, but I ran into the same 520byte formatting thing.

Alas, with all my knowledge, I am not a linux guy. Not yet. I need help mates.

What in the world do I do? What are the commands? Can anyone help me? I am at a loss. I downloaded System Rescue CD, as it has sg3_utils in it, and I made a bootable usb flash drive.

This is as far as I got. See below. How do I run the application? Help a brother out will ya? :eek:

I'm booting this off a Dell R430:

 
  • Like
Reactions: Samir

mmo

Active Member
Sep 17, 2016
463
242
43
40
Hello friends!

I recently came into a set of 100GB SAS HP 3PAR ssd's. I wanna use 'em, but I ran into the same 520byte formatting thing.

Alas, with all my knowledge, I am not a linux guy. Not yet. I need help mates.

What in the world do I do? What are the commands? Can anyone help me? I am at a loss. I downloaded System Rescue CD, as it has sg3_utils in it, and I made a bootable usb flash drive.

This is as far as I got. See below. How do I run the application? Help a brother out will ya? :eek:

I'm booting this off a Dell R430:

You might want to try: pacman -S sg3_utils
 
  • Like
Reactions: Sleyk

Samir

Well-Known Member
Jul 21, 2017
1,306
375
83
45
Does the parted magic live cd from the ultimate boot cd have the utilities needed?
 
  • Like
Reactions: Sleyk

Sleyk

Well-Known Member
Mar 25, 2016
1,007
393
83
Stamford, CT
You might want to try: pacman -S sg3_utils
Great! This worked! Thanks! It did give me an output to use "Sy" to download some related dependencies, so I added the "y" and it seems like it went through.

But now I get this:



What do I do? Walk me through this guys. Do I then use the commands from the first post?

Thanks again for all your help you linux gurus!
 

mmo

Active Member
Sep 17, 2016
463
242
43
40
Great! This worked! Thanks! It did give me an output to use "Sy" to download some related dependencies, so I added the "y" and it seems like it went through.

But now I get this:



What do I do? Walk me through this guys. Do I then use the commands from the first post?

Thanks again for all your help you linux gurus!
I think the easiest way to do is to create a Live CentOS 7 usb drive, then follow the steps in the first post. You can download the either image in the link below and use your preferred software to create the bootable usb drive.

https://buildlogs.centos.org/centos/7/isos/x86_64/CentOS-7-live-GNOME-x86_64.iso
https://buildlogs.centos.org/centos/7/isos/x86_64/CentOS-7-live-KDE-x86_64.iso
 
  • Like
Reactions: Sleyk

Sleyk

Well-Known Member
Mar 25, 2016
1,007
393
83
Stamford, CT
  • Like
Reactions: Samir

german

New Member
Feb 26, 2020
1
0
1
Entre Ríos, Argentina
Hi, sorry for my English (I'm using google translator).

I describe my hardware and then comment on the problem:

- Dell R730 server.
- Controller “PERC H730 Mini (Built-in)” with the firmware version updated to “v25.5.6.0009”.
- RAID10 of four 600GB disks each manufactured by HGST with the firmware version updated to “EJ38” and a block size of 512B.
- A 600GB disk manufactured by Toshiba “AL13SXB60EA” with the firmware version updated to “DL02” and a block size of 4KB.

The problem I have is that I cannot add the Toshiba HDD to my HGST disk RAID, nor create a RAID, clearly because of the block size.

I tried everything I saw in this thread and many more, and the odd thing is that it doesn't give me an error when running
Code:
sg_format --format --size = 512 /dev/sg4
I also tried with
Code:
sg_format - -format --size = 512 /dev/sde
But it runs perfect and takes its due time (1: 20hs approx.) To complete the task 100%. But at the end I check again with “fdisk -l” and nothing has changed the size of the block, it still has 4KB and therefore even if I try again I cannot add it to my RAID of disks.
Code:
root@ubuntu:/#sg_format --format --size=512 -v -v /dev/sg4
open /dev/sg4 with flags=0x802
    inquiry cdb: 12 00 00 00 24 00
    TOSHIBA   AL13SXB60EA       DL02   peripheral_type: disk [0x0]
      PROTECT=1
      << supports protection information>>
    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=146515446 [0x8bba5f6]
  Block size=4096 [0x1000]
    mode select (10) cdb: 55 11 00 00 00 00 00 00 1c 00
    mode select (10) parameter list
        00 00 00 00 00 00 00 08  00 00 00 00 00 00 02 00
        01 0a c0 3f ff 00 00 00  3f 00 1f 40

A FORMAT will commence in 10 seconds
    ALL data on /dev/sg4 will be DESTROYED
        Press control-C to abort
A FORMAT will commence in 5 seconds
    ALL data on /dev/sg4 will be DESTROYED
        Press control-C to abort
    format cdb: 04 18 00 00 00 00
    format parameter list:
        00 02 00 00

Format has started
    test unit ready cdb: 00 00 00 00 00 00
test unit ready:  Fixed format, current;  Sense key: Not Ready
 Additional sense: Logical unit not ready, format in progress
  Progress indication: 4.17%
Format in progress, 4.17% done
    test unit ready cdb: 00 00 00 00 00 00
Code:
root@ubuntu:/#fdisk -l
Disco /dev/sde: 600.1 GB, 600127266816 bytes
255 cabezas, 63 sectores/pista, 9120 cilindros, 146515446 sectores en total
Unidades = sectores de 1 * 4096 = 4096 bytes
Tamaño de sector (lógico / físico): 4096 bytes / 4096 bytes
Tamaño E/S (mínimo/óptimo): 4096 bytes / 4096 bytes
Identificador del disco: 0x00000000
Code:
root@ubuntu:/#sg_scan -i
/dev/sg4: scsi0 channel=0 id=4 lun=0
    TOSHIBA   AL13SXB60EA       DL02 [rmb=0 cmdq=1 pqual=0 pdev=0x0]
I run all this from an Ubuntu 14.04LTS live CD that I have on hand and the Toshiba HDD in non-RAID mode or the HBA mode of the controller.

If someone can help me change the size of my Toshiba blocks, I will appreciate it very much. Best regards.
 
Last edited:

Samir

Well-Known Member
Jul 21, 2017
1,306
375
83
45
I don't think you can format a 4k sector drive to 512/520/528. I may be wrong so someone please correct me if I am.
 
  • Like
Reactions: german

Erokitsune

New Member
Mar 9, 2020
2
0
1
I purchased a Seagate EMC drive to attempt to format it back to 512 and am having some issues.

The model is ST3000NM0023.

I have it in a supermicro unit and can see the drive just fine. I can format it to 520 but whenever I try to format it to 512 I get

mode select command illegal request

sudo sg_format --format --size=512 --fmtpinfo=0 /dev/sdf

If I add --six -v I get a sense key illegal request error.
 

markymarrow

New Member
Mar 12, 2020
1
1
1
I purchased a Seagate EMC drive to attempt to format it back to 512 and am having some issues.

The model is ST3000NM0023.

I have it in a supermicro unit and can see the drive just fine. I can format it to 520 but whenever I try to format it to 512 I get

mode select command illegal request

sudo sg_format --format --size=512 --fmtpinfo=0 /dev/sdf

If I add --six -v I get a sense key illegal request error.
I find myself in a similar position with a 3TB Seagate drive, I'm currently 15% through a format using
SeaChest Format from here Seagate/ToolBin

Code:
./SeaChest_Format_151_12130_64 -d /dev/sg0 --fastFormat 1 --formatUnit 512 --confirm this-will-erase-data
 
  • Like
Reactions: Whaaat

Isithral

New Member
Mar 13, 2020
2
0
1
Hi all,
first of all thanks for the massive information and provided support.

I have an H330 flashed to HBA mode [ guide by this forum ] and want to resize some NetApp hard drives but get this error:

Code:
# sudo sg_format --format --size=512 -v /dev/sda
    SEAGATE   ST6000NM0104      NE03   peripheral_type: disk [0x0]
      PROTECT=1
      << supports protection information>>
      LU name: 5000c5008669fb3f
    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=11721045168 [0x2baa0f4b0]
  Block size=512 [0x200]

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 2b 00 00 00 00 00 00 00 00
Format unit command: Data protect, type: sense key; write protected media?
FORMAT UNIT failed
I can not format the drive.

Has anybody an idea how I can solve this issue?

thanks a lot
Isithral
 

error00242

New Member
Mar 19, 2020
4
0
1
Apparently, I've tried to do the same thing sg_format to some of my SSDs it worked out well for 3 units, meanwhile another 3 units I was hit with an error. "Additional sense: Access denied - no access rights".
I've tested out, if I were to format them again to 520b, it works well, if I've tried to convert them to 512b, apparently I wasn't allowed to. Is there any work around for this matter? I am pulling out my hair for days...tried going into windows bootable, sedutil but wasn't able to detect the drive at all. When I went into the liveboot centos7, then I wasn't able to use the sedutil at all.
 

azev

Active Member
Jan 18, 2013
737
203
43
@Isithral Hey, unfortunately there appear to be some drives that have some kind of bios lock that prevent it to be re-formated to a different block size. Have you check this ahouston/setblocksize Some people reported that this method works where the standard sg_format one does not. Good Luck !!