Skip to contentSkip to conversation

convert 520 byte sector disk to 512 byte sector?

DISCUSSION Grant Grundler 3 participants 8 messages Jun 9, 2003 – Jun 18, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

Hi,

I've got several ST336753FC and ST336704FC disks which came out of a VA7100 RAID enclosure. The VA7100 is able to reformat those disks from 512 to 520 bytes per sector. I'd like to convert them back to 512 byte/sector for use as "regular" disks. Anyone know the trick to do that?

I once wrote a program to use scsi-pass thru (aka scsi generic) under HPUX to do exactly that for regular parallel SCSI disks. I dug that up, dusted it off and ported it to linux. Source code is on http://gsyprf11.external.hp.com/blk512/

I haven't tried blk512-linux with parallel SCSI under linux, but I know it's not working with the above FC disks when run on an ia64-linux box. The format mode page "current" values aren't changing using the "trick" that worked for the parallel SCSI disks. And the "writeable" indicates none of the formt mode page parameters are allowed to be changed (clearly a lie).

The default format mode page clearly shows the drive was 512 byte/sector. I'd just like to get them back to that for the some performance testing.

thanks,
grant

#1 lore raw
Quoted 15 lines · Grant Grundler

Hi,

I've got several ST336753FC and ST336704FC disks which came out of a VA7100 RAID enclosure. The VA7100 is able to reformat those disks from 512 to 520 bytes per sector. I'd like to convert them back to 512 byte/sector for use as "regular" disks. Anyone know the trick to do that?

I haven't tried blk512-linux with parallel SCSI under linux, but I know it's not working with the above FC disks when run on an ia64-linux box. The format mode page "current" values aren't changing using the "trick" that worked for the parallel SCSI disks. And the "writeable" indicates none of the formt mode page parameters are allowed to be changed (clearly a lie).

Quoted 2 lines

The default format mode page clearly shows the drive was 512 byte/sector. I'd just like to get them back to that for the some performance testing.

I did this for some Seagate FC drives (don't have the exact model numbers handly), but don't have my hacks, and can't find details of my results. I used the same thing you have in your code - set the "direct access device mode paramter block descriptor"'s block length (versus the more obvious data bytes per physical page), and then formatted the drive.

Did you try setting the data bytes per physical page?

So the MODE SENSE format device page (0x3) "data bytes per physical sector" does _not_ show 512 bytes after you send the MODE SELECT format device page? That is what I (eventually) saw.

Did you format the drive after changing the block size?

Are you sure the mode select is really working in your code? I suppose there are no other format page values you can change.

I can't remember when the MODE SENSE format page showed the modified block size for me - I believe it was after the MODE SELECT format page, rather than after the FORMAT command itself.

-- Patrick Mansfield

#2 lore raw
Quoted 5 lines · Patrick Mansfield

I did this for some Seagate FC drives (don't have the exact model numbers handly), but don't have my hacks, and can't find details of my results. I used the same thing you have in your code - set the "direct access device mode paramter block descriptor"'s block length (versus the more obvious data bytes per physical page), and then formatted the drive.

thanks - that's good to know that at least I'm banging my head bloody against the right wall. I suspect the data isn't going out to the device like it's supposed too. But I'm not seeing the problem with the code.

Quoted 1 line

Did you try setting the data bytes per physical page?

I think so. But I recall checking the "Mask" data for the format mode page and it shows nothing on the page can be modified. Here's the blk512-linux output for that device:

iota:/home/grundler/Src# ./blk512-linux -MS -c 71132960  /dev/sg15

Mode Sense Mask:

0x0000:   23 00 10 08 04 2c 1d 80  00 00 02 08 83 16 00 00
0x0010:   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
0x0020:   00 00 00 00

Mode Sense Saved:

0x0000:   23 00 10 08 04 2c 1d 80  00 00 02 08 83 16 24 54
0x0010:   00 00 00 14 00 00 02 31  02 08 00 01 00 88 00 60
0x0020:   40 00 00 00

Mode Sense Current:

0x0000:   23 00 10 08 04 2c 1d 80  00 00 02 08 83 16 24 54
0x0010:   00 00 00 14 00 00 02 31  02 08 00 01 00 88 00 60
0x0020:   40 00 00 00

Mode Sense Default:

0x0000:   23 00 10 08 04 2c 1d 80  00 00 02 08 83 16 24 54
0x0010:   00 00 00 14 00 00 02 3d  02 00 00 01 00 88 00 60
0x0020:   40 00 00 00

Mode Select Data:

0x0000: 00 00 00 08 04 3d 67 20 00 00 02 00

        mlen 0xc  resid 0x0 duration 0  info 0x0

Done setting /dev/sg15 to 71132960 blocks/512 bytes_per_block iota:/home/grundler/Src#

Quoted 3 lines

So the MODE SENSE format device page (0x3) "data bytes per physical sector" does _not_ show 512 bytes after you send the MODE SELECT format device page? That is what I (eventually) saw.

correct. I was expecting it show "02 00" in the "current" page if I run the command a second time or run "scsiinfo -f".

Quoted 1 line

Did you format the drive after changing the block size?

No. I will When the MODE SENSE for page 3 shows 512 bytes/block.

Quoted 1 line

Are you sure the mode select is really working in your code?

I have no way of knowing other then device/driver return codes. And since I don't have a FC protocol analyzer, i need help to figure out if it's just something silly I'm doing wrong.

It's quite possible the qlogic driver is mangling the command and/or return values. I'm using qla2300 v6.04.00 with qla2312 chip.

I think the current code is sending "default" page data for the MODE SELECT. I might try updating the MODE SELECT data and verify no extra bits are set in the "descriptor" header.

Quoted 1 line

I suppose there are no other format page values you can change.

The device claims there are none.

Quoted 3 lines

I can't remember when the MODE SENSE format page showed the modified block size for me - I believe it was after the MODE SELECT format page, rather than after the FORMAT command itself.

yes - that's what I'm expecting. The format command should use the settings in the "current" page. ergo one should be able to read/write the contents of the page before issuing format command.

thanks,
grant

#7 lore raw
In reply to Patrick Mansfield
Quoted 1 line · Patrick Mansfield

Are you sure the mode select is really working in your code?

Short answer, i don't think so.

I found a SCSI IBM "DGHS09Y CLAR09" still formatted to 520 byte. I've twiddled the code a bit so the output isn't identical to previous FC runs. But my main goal is to show the format mode page "Mask" isn't all zero's for this drive and blk512-linux.c doesn't work for a "regular" SCSI drive either.

The DGHS09Y drive is behind 53c1030 (built-in) using mpt v2.03.00 driver.

thanks,
grant

iota:/home/grundler/Src/blk512# scsiinfo -i /dev/sg0

Inquiry command
---------------

Relative Address                   0
Wide bus 32                        0
Wide bus 16                        1
Synchronous neg.                   1
Linked Commands                    1
Command Queueing                   1
SftRe                              0
Device Type                        0
Peripheral Qualifier               0
Removable?                         0
Device Type Modifier               0
ISO Version                        0
ECMA Version                       0
ANSI Version                       3
AENC                               0
TrmIOP                             0
Response Data Format               2
Vendor:                    IBM     
Product:                   DGHS09Y  CLAR09 
Revision level:            HP1A68007236GAGSPDH01A  DG11802742000
iota:/home/grundler/Src/blk512# ./blk512-linux -s 512 -c 17916240  /dev/sg0

Mode Sense Current:

0x0000:   23 00 10 08 00 ff ff ff  00 00 02 08 83 16 00 0a
0x0010:   00 02 00 00 00 00 01 13  02 08 00 01 00 1c 00 47
0x0020:   40 00 00 00

Mode Sense Default:

0x0000:   23 00 10 08 00 ff ff ff  00 00 02 08 83 16 00 0a
0x0010:   00 02 00 00 00 00 01 13  02 08 00 01 00 1c 00 47
0x0020:   40 00 00 00

Mode Select Data:

0x0000: 00 00 00 08 01 11 61 50 00 00 02 00

        mlen 0xc  resid 0xb duration 0  info 0x0
Done setting /dev/sg0 to 17916240 blocks/512 bytes_per_block
iota:/home/grundler/Src/blk512# scsiinfo -f /dev/sg0

Data from Format Device Page
----------------------------

Removable Medium                   0
Supports Hard Sectoring            1
Supports Soft Sectoring            0
Addresses assigned by surface      0
Tracks per Zone                    10
Alternate sectors per zone         2
Alternate tracks per zone          0
Alternate tracks per lun           0
Sectors per track                  275
Bytes per sector                   520
Interleave                         1
Track skew factor                  28
Cylinder skew factor               71
iota:/home/grundler/Src/blk512# ./blk512-linux -M -s 512 -c 17916240  /dev/sg0

Mode Sense Mask:

0x0000:   23 00 10 08 00 ff ff ff  00 00 02 08 83 16 ff ff
0x0010:   ff ff 00 00 00 00 00 00  ff ff ff ff 00 00 00 00
0x0020:   00 00 00 00

Mode Sense Current:

0x0000:   23 00 10 08 00 ff ff ff  00 00 02 08 83 16 00 0a
0x0010:   00 02 00 00 00 00 01 13  02 08 00 01 00 1c 00 47
0x0020:   40 00 00 00

Mode Sense Default:

0x0000:   23 00 10 08 00 ff ff ff  00 00 02 08 83 16 00 0a
0x0010:   00 02 00 00 00 00 01 13  02 08 00 01 00 1c 00 47
0x0020:   40 00 00 00

Mode Select Data:

0x0000:   00 00 00 08 01 11 61 50  00 00 02 00 03 16 00 0a
0x0010:   00 02 00 00 00 00 01 13  02 00 00 01 00 1c 00 47
0x0020:   40 00 00 00
        mlen 0x24  resid 0x23 duration 0  info 0x0

Done setting /dev/sg0 to 17916240 blocks/512 bytes_per_block

#3 lore raw
In reply to Grant Grundler
Quoted 96 lines · Grant Grundler
Quoted 5 lines · Patrick Mansfield

I did this for some Seagate FC drives (don't have the exact model numbers handly), but don't have my hacks, and can't find details of my results. I used the same thing you have in your code - set the "direct access device mode paramter block descriptor"'s block length (versus the more obvious data bytes per physical page), and then formatted the drive.

thanks - that's good to know that at least I'm banging my head bloody against the right wall. I suspect the data isn't going out to the device like it's supposed too. But I'm not seeing the problem with the code.

Quoted 1 line

Did you try setting the data bytes per physical page?

I think so. But I recall checking the "Mask" data for the format mode page and it shows nothing on the page can be modified. Here's the blk512-linux output for that device:

iota:/home/grundler/Src# ./blk512-linux -MS -c 71132960  /dev/sg15

Mode Sense Mask:

0x0000:   23 00 10 08 04 2c 1d 80  00 00 02 08 83 16 00 00
0x0010:   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
0x0020:   00 00 00 00

Mode Sense Saved:

0x0000:   23 00 10 08 04 2c 1d 80  00 00 02 08 83 16 24 54
0x0010:   00 00 00 14 00 00 02 31  02 08 00 01 00 88 00 60
0x0020:   40 00 00 00

Mode Sense Current:

0x0000:   23 00 10 08 04 2c 1d 80  00 00 02 08 83 16 24 54
0x0010:   00 00 00 14 00 00 02 31  02 08 00 01 00 88 00 60
0x0020:   40 00 00 00

Mode Sense Default:

0x0000:   23 00 10 08 04 2c 1d 80  00 00 02 08 83 16 24 54
0x0010:   00 00 00 14 00 00 02 3d  02 00 00 01 00 88 00 60
0x0020:   40 00 00 00

Mode Select Data:

0x0000: 00 00 00 08 04 3d 67 20 00 00 02 00

        mlen 0xc  resid 0x0 duration 0  info 0x0

Done setting /dev/sg15 to 71132960 blocks/512 bytes_per_block iota:/home/grundler/Src#

Quoted 3 lines

So the MODE SENSE format device page (0x3) "data bytes per physical sector" does _not_ show 512 bytes after you send the MODE SELECT format device page? That is what I (eventually) saw.

correct. I was expecting it show "02 00" in the "current" page if I run the command a second time or run "scsiinfo -f".

Quoted 1 line

Did you format the drive after changing the block size?

No. I will When the MODE SENSE for page 3 shows 512 bytes/block.

Quoted 1 line

Are you sure the mode select is really working in your code?

I have no way of knowing other then device/driver return codes. And since I don't have a FC protocol analyzer, i need help to figure out if it's just something silly I'm doing wrong.

It's quite possible the qlogic driver is mangling the command and/or return values. I'm using qla2300 v6.04.00 with qla2312 chip.

I think the current code is sending "default" page data for the MODE SELECT. I might try updating the MODE SELECT data and verify no extra bits are set in the "descriptor" header.

Quoted 1 line

I suppose there are no other format page values you can change.

The device claims there are none.

Quoted 8 lines
Quoted 3 lines

I can't remember when the MODE SENSE format page showed the modified block size for me - I believe it was after the MODE SELECT format page, rather than after the FORMAT command itself.

yes - that's what I'm expecting. The format command should use the settings in the "current" page. ergo one should be able to read/write the contents of the page before issuing format command.

Grant,
www.seagate.com have a tool called "seatool" that may do the trick for you.

Doug Gilbert

#4 lore raw
Quoted 2 lines · Douglas Gilbert

www.seagate.com have a tool called "seatool" that may do the trick for you.

Doug,
thanks - but last time I checked, it's an x86 binary only driver. I guess I could try it anyway and see if the IOCTLs have 32-bit compat support in ia64 kernel.

thanks,
grant

#5 lore raw
In reply to Douglas Gilbert
Quoted 1 line · Douglas Gilbert

www.seagate.com have a tool called "seatool" that may do the trick for you.

http://seatool.seagate.com/

It in fact did for at least one of the mechs (ST318304FC). I'll iterate through the others.

But "st" can not query the status of the format it kicks off... and thus it will never terminate properly on an ia64-linux machine:

...
read_capacity (SG_IO) error: Bad address
FORMAT on drive /dev/sg24 is 0 % complete . . .
...

I ^C 'd the program after 2 hours and all was well. I suspect the format doesn't take the long though (40 minutes for 9G 10K rpm was previous experience).

I'll run "strace -o st.out st -B 512 ..." on the next round and see what magic the program is doing. That might give me enough clues to get my own code working.

thanks,
grant

#6 lore raw
In reply to Douglas Gilbert
Quoted 2 lines · Douglas Gilbert

www.seagate.com have a tool called "seatool" that may do the trick for you.

Douglas,
I don't recall if I followed up - "st" in fact did work on ia64. The FC drives are now 512 byte sector. The "read_capacity" call to monitor FORMAT_UNIT progress fails even though the FORMAT_UNIT seems to complete successfully.

I also wrote a script (attached) to identify the block size of each "sg" device.

In the interest of writing a "generic" tool, can someone decode the SG command below?

I'm using the 2.4 SG interface and still haven't found any decent description how the 2.2 SG kernel interface works.

open("/dev/sg26", O_RDWR) = 7
write(7, "\x00\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x15\x11\x00\x00\x0c\x00\x00\x00\x00\x08\x04\x2c\x1d\x80\x00\x00\x02\x00", 54) = 54 read(7, "\x24\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 36) = 36

(After logging the entry in stlog.txt, "st" sends a FORMAT_UNIT.)

thanks,
grant

for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
do echo -n "sg$i "
scsiinfo -i /dev/sg$i | gawk '/Product/ {printf $2 "\t"}'
scsiinfo -f /dev/sg$i | gawk '/Bytes per sector/ {print $4}'
done