unsupported sector size 520

Categories: General, Linux, Misc

so i picked up a batch of these 146gb (Vendor: IBM Model: IC35L146 CLAR146 Rev: R58A) FC-AL drives from a fire sale.

i pop it into the machine when i notice this in 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

wtf ??!!??

oh – thats right…clarion uses a sector size of 520 over the conventional 512.

what to do now ?

fdisk & parted did not work.

here is what i did:
first, i installed sg3_utils (in gentoo sys-apps/sg3_utils):

venus tarballs # sg_scan -i
/dev/sg0: scsi0 channel=0 id=0 lun=0
    SEAGATE   ST136403FSUN36G   144A [rmb=0 cmdq=1 pqual=0 pdev=0x0]
/dev/sg1: scsi0 channel=0 id=1 lun=0
    IBM       IC35L146 CLAR146  R58A [rmb=0 cmdq=1 pqual=0 pdev=0x0]

so i now download a copy of setblocksize:

venus tarballs # ./setblocksize

setblocksize V0.2

Checking parameters ...
   Parameter error!
   Usage: 'setblocksize [-b<Blocksize in Byte>] [-t<Timeout in Minutes>] <sg_device>'

sweet !!! now lets convert the block size from 520 to 512:

venus tarballs # ./setblocksize -b512 /dev/sg1

setblocksize V0.2

Checking parameters ...
   Blocksize specified.
   Done.
New blocksize: 512 Bytes
Format timeout: 120 minutes
Open device file ...
   Done.
Prepare command ...
   Done.
Send INQUIRY command ...
   Done.
Check status ...
   Command successful.
Check for LUN ...
   LUN present.

===============================================================================
SCSI ID     : 1
LUN         : 0
Connected to: Host0 / Channel0
Manufacturer: IBM
Model       : IC35L146 CLAR146
Device type : Disk
===============================================================================
Do you really want to reformat this device [y/n]? y

Prepare command ...
   Done.
Send MODE SELECT command ...
   Done.
Check status ...
   Command successful.
Prepare command ...
   Done.
Send FORMAT UNIT command ...
   *** Please wait - Do not manually interrupt or power down! ***
   Done.
Check status ...
   Command successful.
Close device file ...
   Done.

Exiting ...

now lets give this a quick reboot
dmesg output:

[   89.179127]   Vendor: IBM       Model: IC35L146 CLAR146  Rev: R58A
[   89.179149]   Type:   Direct-Access                      ANSI SCSI revision: 03
[   89.182229] SCSI device sdb: 286749476 512-byte hdwr sectors (146816 MB)
[   89.184112] sdb: Write Protect is off
[   89.184119] sdb: Mode Sense: e3 00 00 08
[   89.187119] SCSI device sdb: drive cache: write through

[   89.381729] SCSI device sdb: 286749476 512-byte hdwr sectors (146816 MB)
[   89.391931] sdb: Write Protect is off
[   89.400225] sdb: Mode Sense: e3 00 00 08
[   89.402247] SCSI device sdb: drive cache: write through
[   89.410634]  sdb:VFS: Mounted root (ext2 filesystem) readonly.
[   89.424964]  unknown partition table
[   89.433541] sd 0:0:1:0: Attached scsi disk sdb
[   89.502697] sd 0:0:1:0: Attached scsi generic sg1 type 0

fdisk:

venus ~ # fdisk -l /dev/sdb

Disk /dev/sdb: 146.8 GB, 146815731712 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

NICE!!!

i can now use my drives….

UPDATE 01-02-2009:
sdb from above is now sda. installation was moved over using:

tar cf - root folder | (cd /mnt/mounted partition; tar xvf -)
example: tar cf - bin boot dev (...and so on...) | (cd /mnt/sdaX; tar xvf -)
so now my fdisk output is:

$ sudo /sbin/fdisk -l
Password:

Disk /dev/sda (Sun disk label): 255 heads, 63 sectors, 17849 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Flag    Start       End    Blocks   Id  System
/dev/sda1             0        65    522112+  83  Linux native
/dev/sda2  u         65       130    522112+  82  Linux swap
/dev/sda3             0     17849 143372092+   5  Whole disk
/dev/sda4           130      5229  40957717+  83  Linux native
/dev/sda5          5229     10328  40957717+  83  Linux native
/dev/sda6         10328     17849  60412432+  83  Linux native

Disk /dev/sdb (Sun disk label): 255 heads, 63 sectors, 4427 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Flag    Start       End    Blocks   Id  System
/dev/sdb1             0      4427  35559877+  83  Linux native
/dev/sdb3             0      4427  35559877+   5  Whole disk
«
»
  • omg, thank you!! im about to try this on some netapp drives that we bought – ill let you know how it goes.

    itll be a while, though – we have 70 drives πŸ™

  • Excellent work! I have 5 EMC SAS drives that were collecting dust, now I can actually put them to good use.

    Would this work the opposite way – if I wanted to plug a bigger non-EMC-branded sas drive into an EMC?

  • There’s also the sg_format option (which is part of the “sg3_utils” package on RHEL/CentOS).

    # 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]

    # 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

  • Thank you very much for this solution. I’d like to build a system expressly for this 520-to-512 conversion (I have over a hundred drives to convert). Do I need an original Clariion rig (i.e. EMC HBA, Clariion drive enclosure and even a PowerEdge server) to perform this conversion? Is this even possible on an x86 machine? If so, what hardware & Linux variant would have the best chance of success? (I have a Qlogic QLA2340 HBA, Xyretex drive enclosure available.) Thanks for advice!

    • i’ve never tested this on an x86 machine, but if the controllers are properly configured and the kernel see’s them then i don’t see any reason as to why it won’t work. most of the stuff i do is either in Gentoo or LFS ( linux from scratch) but with a little work you should be able to get this to work under any distro.

      just make sure that your kernel has full support for all the hardware or can at least see it all. it will eliminate a ton of heartache later on.

      • I so appreciate your advice! May I ask what exact hardware/OS combo you used for the conversion? (A duplicate of your successful recipe will definitely eliminate a ton of heartache πŸ™‚

        • when i wrote this i was using a sun blade 2k with a QLogic Corp. QLA2200 64-bit Fibre Channel Adapter (rev 05) (qla2xxx), but i have gotten it working with random x86_64 gentoo installs using qlogic fibre cards.

  • I wrote a quick script that will go through all the /dev/sg? drives and format them all to the 512 block from the 520 block. You will need to install the sg3-utils as suggested, but you do not need the setblocksize app. Hope this helps make it a little easier. I did this on a Ubuntu 12.04 system.

    ##SetDrives512.bsh##
    — Begin script —
    #!/bin/bash

    sg_scan | awk -F: ‘{print $1}’ | while read drive
    do
    sg_format –format –size=512 $drive &
    done
    — End Script —

  • Hi Terrance, great work. For those using this on Ubuntu machines the sg_scan line needs to look like this

    sg_scan | awk -F ‘:’ ‘{print $1}’ | while read drive

    the difference is the quotes around the colon after -F

  • Just wanted to drop a thank you as I purchased some rebranded drives and figured I was sunk when they didn’t want to play. Happy to say after following your tip – able to use all of them! Thanks for sharing.

  • I had a similar issue with 2 types of disks, after buying an HBA and a T-Card in order to loop a single FC Scsi disk I could not find proper drivers for my Fc909 ConnectCom CSB-FC1000 HBA under Linux. So only managed to get the windows Xp drivers, Seatools Enterprise could find the Netapp disks and managed to format and change block size from 520 to 512 bytes, but had a problem with Clariion EMC disks, seatools just stopped after 2:26 min :(.

    After several headaches and hours looking in internet I found this marevollous dos compiled version of sg3_utils that safe my life, just using the sg_scan found my clarion disk as PD3, so I just had to send command sg_format –format –size=512 –verbose and wait 2hrs to complete the 300Gb low level format.

    Thanks for this post
    Best Regards

    • would depend on speed of drive. i cant say for sure since sometimes it takes longer than other times. when i last did this, it was for a bunch of FC-AL drives.

  • If you have a lot of drives to format, it may take a long time with sg_format as it wait until it finished before doing the next one (with a while loop I mean).
    Useful tip is to use the “-e” flag with sg_format then monitor operations with sg_turs -p
    but it may hang you tty as well…
    Another option is to just take a look at the drives leds πŸ™‚

  • The program setblocksize did not work at all for us; it couldn’t get some required data from the drive and quit. HOWEVER, we were able to use sg3_format to change a drive from having 520 bytes/sector to only 512 bytes/sector. Took about the same time to normally wipe every sector of the drive; about 90 minutes for this about 140 GB ST9300603SS (from HDS-VSP) by Seagate.

    • We used: sudo sg_format –format –size=512 /dev/sdb
      (with drive attached as a slave to our boot drive); under Ubuntu 14.04 LTS. Easy to install the sg3_utils using apt-get.

  • how can I edit what I submitted? I was wrong about the capacity of the drive; after checking the model number, I found it was actually 280 GB; no wonder it took so long.

  • I should also add that “HDS” means “Hitachi Data Systems” and although the label shows it was made by Seagate, electronically, the model number displays as “DKS5B-J300SS” instead of the Seagate model number shown on the label.

  • thanks for posting this. i had the same problem with 3TB disks from an HDS system as well. those 8 extra bytes are used for checksums in storage arrays.
    not needed in my x86 zfs raid.
    formatting the disks takes over 10h each though πŸ˜‰

    • thanks for posting this. i had the same problem with 3TB disks from an HDS system as well. those 8 extra bytes are used for checksums in storage arrays.
      not needed in my x86 zfs raid.
      formatting the disks takes over 10h each though πŸ˜‰

      Which HDS model are you using?
      I’m trying to format my Hitachi HUS723030ALS641 3TB SAS disks (nohup sg_format –format –fmtpinfo=2 –size=512 /dev/sdX &). It goes on, but a strange info comes out: “descriptor too short”.

      Did you have the same issue?

      Bye

  • Thank you for the tips and the comments, the setblocksize has max timeout settings to 600 Minutes and that is not enough on large drives.

    I will try the

    sg_format Γ’β‚¬β€œformat Γ’β‚¬β€œsize=512 /dev/sgx on large drives.

    • Hope this helps someone in the future – it takes over 4 hours per TB of disk to use setblocksize, but it really did work for me where sg_format failed.

      I’ve put together a very slightly modded version of setblocksize with higher possible and default timeouts, as well as the instructions on how to compile it etc. etc.

      https://github.com/ahouston/setblocksize/wiki

      So far I’ve rescued 7 of my EMC 3TB HGST drives, waiting on the last batch to finish up πŸ™‚

  • Is there a specific raid card we should use to perform this? We have used Intel and MegaRAID 9221 and 9261, but not able to see the drives at all.

  • Hello need your help have used sg3_utils to format sas drives OK, but trying to format an EMC SSD SATA that is 520, i cannot proceed with sas controller or mobo direct it does not work… just gives error invalid field in CDB command NOT successfull. PLEASE HELP!!!!

  • Thank you so much! I got an EMC enclosure with drives second hand and was bashing my head against in the wall. Your guide helped me get all the drives working in a new environment!

  • Its 2020, maybe too late,
    sg_utility worked for me with mechanical SAS drives,
    but not with 520 bps SSD Micron 410m from EMC rack!!!!!

    Anybody has a solution?

    Thanks


Leave a Reply

Your email address will not be published. Required fields are marked *