How to change the block size of a hard drive using Linux and the scu utility (updated May 5 2011 (previously updated May 6 2004!))

Thanks Devin Trotter for finding this page so many years after I put it up, and finding a broken link which I've fixed.

Archived content follows below, since every 5 years or so someone seems to stumble upon it:

I came across a great deal on used 36gb FCAL IBM drives pulled from a Clariion on eBay, so I grabbed 10 of them. That was the easy part. The hard part was getting them to work. The A5000 would spin them up OK, but when Solaris scanned the bus, it would just hang when it came up to one of these new disks.

It turns out that Clariion (and many other RAID) disks are formatted with 520 byte sectors, but Sun and Linux and Windows expect it to be 512. This causes the disk to be unusable on any of these systems. Needless to say, that was quite a bummer.

It took me a few weeks of Googling and experimentation to come up with a procedure that works. If anyone tells you that you can't change the block size of a disk drive, I'm proud to say that they are sadly mistaken.

Here's what you need to do:

Quick notes:

You don't need the sg_utils for this. You can start scu and use the set nexus command to set the bus, target, and lun of the disk you're going to be playing with. sg_scan and /dev/sgX is just simpler in my opinion.

Be careful about what disk you pick and format!

Update! You can do this with Solaris too!

scu also runs under Solaris. I repeated this procedure on a Solaris box, but there were a few differences. I'm guessing these are also present in the newer versions of scu on all platforms, but here's how it works.

 26. c7t49d0 <drive not available>
/pci@8,600000/pci@1/SUNW,qlc@4/fp@0,0/ssd@w21000020375c04ef,0

scu -f /dev/rdsk/c7t49d0s0

set bypass on
set device block-length 512
format

Here's a log of a linux session:

[root@ichigo scu.d]# modprobe qlogicfc
[root@ichigo scu.d]# sg_scan -i
/dev/sg0: scsi0 channel=0 id=0 lun=0 [em] type=5
SONY CD-RW CRX0811 MYS2 [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0]
/dev/sg1: scsi1 channel=0 id=1 lun=0 type=0
IBM DRHL36L CLAR36 2247 [wide=0 sync=0 cmdq=1 sftre=0 pq=0x0]
[root@ichigo scu.d]# ./scu -f /dev/sg1
scu> set bypass on
scu> set device block-length 512
scu> format
Formatting device /dev/sg1 (DRHL36L CLAR36), please be patient...
Working ... Fri Apr 25 23:34:26 2003
{...lots of lines of the same stuff deleted...}
Working ... Sat Apr 26 00:38:26 2003
scu> stop
scu> exit
[root@ichigo scu.d]# modprobe -r qlogicfc

Here's a log of a Solaris session:

[root@schweeb scu.d]# ./scu -f /dev/rdsk/c8t52d0s0
scu> set bypass on
scu> set device block-length 512
scu> format
Formatting device /dev/rdsk/c8t52d0s0 (ST136403FC), please be patient...
Working ... Thu May 6 13:30:43 2004
...

Editorial comments: