Re: IBM 520KByte sector size scsi drives

2009-09-11 Thread Milan Prihoda

David Vasek wrote:

On Thu, 10 Sep 2009, Milan Prihoda wrote:


and now,
# dd if=/dev/rsd2c of=disk1.img bs=520

works for me :-)


Are you sure you are getting all 520 bytes from each sector and not 
only first 512 bytes? Can you verify it?


Regards,
David


Hi David,
it seems you're right.

# ls -l
total 33674624
-rw-r--r--  1 root  wheel  4308220800 Sep 11 03:08 disk-tg1.img
-rw-r--r--  1 root  wheel  4308220800 Sep 11 03:09 disk-tg2.img
-rw-r--r--  1 root  wheel  4308220800 Sep 11 03:11 disk-tg3.img
-rw-r--r--  1 root  wheel  4308220800 Sep 11 03:11 disk-tg6.img


# dmesg | grep sd2
sd2 at scsibus1 targ 1 lun 0: IBMAS400, DFHSS4W, 4I4I SCSI2 0/direct fixed
sd2: 4173MB, 520 bytes/sec, 8414494 sec total

so, i dumped 4308220800 bytes from each drive and:
4308220800/520 = 8285040
4308220800/512 = 8414493.75

Yes, it seems, I got only 512 bytes from each sector.

Milan Prihoda.



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Jan Stary
On Sep 10 10:36:41, Milan Prihoda wrote:
 Hi,
 i have few IBM scsi drives from old (risc-based) IBM as/400.

 These drives have 520KByte sector size instead of 512KByte.
 Is there any way how to dump raw data from these drives without
 reformat drive to different sector size ?

 $ dmesg
 ...
 sd2 at scsibus0 targ 3 lun 0: IBMAS400, DFHSS4W, 4I4I SCSI 2 0/direct  
 fixed
 sd2: drive offline
 ...

What is raw data?
Just dd if=/dev/rsd2c of=somewhere.

Or is there a filesystem you can read/dump?
Then dump | restore as usual.

What are you _really_ trying to do?



IBM 520KByte sector size scsi drives

2009-09-10 Thread Milan Prihoda

Hi,
i have few IBM scsi drives from old (risc-based) IBM as/400.

These drives have 520KByte sector size instead of 512KByte.
Is there any way how to dump raw data from these drives without
reformat drive to different sector size ?

$ dmesg
...
sd2 at scsibus0 targ 3 lun 0: IBMAS400, DFHSS4W, 4I4I SCSI 2 0/direct 
fixed

sd2: drive offline
...

Thank You for any ideas.

Milan Prihoda



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Milan Prihoda

Jan Stary wrote:

On Sep 10 10:36:41, Milan Prihoda wrote:
  

Hi,
i have few IBM scsi drives from old (risc-based) IBM as/400.

These drives have 520KByte sector size instead of 512KByte.
Is there any way how to dump raw data from these drives without
reformat drive to different sector size ?

$ dmesg
...
sd2 at scsibus0 targ 3 lun 0: IBMAS400, DFHSS4W, 4I4I SCSI 2 0/direct  
fixed

sd2: drive offline
...



What is raw data?
Just dd if=/dev/rsd2c of=somewhere.

Or is there a filesystem you can read/dump?
Then dump | restore as usual.

What are you _really_ trying to do?

  

Yes, just dd if=/dev/rsd2c 

_really_ ? :-) I am just curious :-)

Milan Prihoda



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Joachim Schipper
On Thu, Sep 10, 2009 at 12:16:27PM +0200, Milan Prihoda wrote:
 Jan Stary wrote:
 On Sep 10 10:36:41, Milan Prihoda wrote:
 Hi,
 i have few IBM scsi drives from old (risc-based) IBM as/400.
 
 These drives have 520KByte sector size instead of 512KByte.
 Is there any way how to dump raw data from these drives without
 reformat drive to different sector size ?
 
 $ dmesg
 ...
 sd2 at scsibus0 targ 3 lun 0: IBMAS400, DFHSS4W, 4I4I SCSI 2
 0/direct  fixed
 sd2: drive offline
 ...
 
 What is raw data?
 Just dd if=/dev/rsd2c of=somewhere.
 
 Or is there a filesystem you can read/dump?
 Then dump | restore as usual.
 
 What are you _really_ trying to do?
 
 Yes, just dd if=/dev/rsd2c 
 
 _really_ ? :-) I am just curious :-)

dd(1) has an option to set the block size (bs=...). Setting this to a
(multiple of) the block size of the underlying hardware may (or may not)
increase performance.

However, the drivers will take care of any hardware issues and present a
stream of bytes to userland, no matter the block size. So plain dd will
work.

Joachim



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread David Vasek

On Thu, 10 Sep 2009, Joachim Schipper wrote:


On Thu, Sep 10, 2009 at 12:16:27PM +0200, Milan Prihoda wrote:

Jan Stary wrote:

On Sep 10 10:36:41, Milan Prihoda wrote:

Hi,
i have few IBM scsi drives from old (risc-based) IBM as/400.

These drives have 520KByte sector size instead of 512KByte.
Is there any way how to dump raw data from these drives without
reformat drive to different sector size ?

$ dmesg
...
sd2 at scsibus0 targ 3 lun 0: IBMAS400, DFHSS4W, 4I4I SCSI 2
0/direct  fixed
sd2: drive offline
...


What is raw data?
Just dd if=/dev/rsd2c of=somewhere.

Or is there a filesystem you can read/dump?
Then dump | restore as usual.

What are you _really_ trying to do?


Yes, just dd if=/dev/rsd2c 

_really_ ? :-) I am just curious :-)


dd(1) has an option to set the block size (bs=...). Setting this to a
(multiple of) the block size of the underlying hardware may (or may not)
increase performance.

However, the drivers will take care of any hardware issues and present a
stream of bytes to userland, no matter the block size. So plain dd will
work.


The drive is reported as offline.

As I understand it from sys/scsi/sd.c, drive offline means an error was 
reported by scsi_test_unit_ready() function call. Possibly the 520 
bytes/sector is not compatible with the controller the OP used or with the 
OpenBSD driver/scsi subsystem? Don't know. I doubt that media (i.e. 
blocks) is accessible in this condition.


Regards,
David



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Brynet
David Vasek wrote:
 The drive is reported as offline.

 As I understand it from sys/scsi/sd.c, drive offline means an error was
 reported by scsi_test_unit_ready() function call. Possibly the 520
 bytes/sector is not compatible with the controller the OP used or with the
 OpenBSD driver/scsi subsystem? Don't know. I doubt that media (i.e.
 blocks) is accessible in this condition.

 Regards,
 David

Hi,

I have an ATAPI LS-120 drive that always reports itself as being
offline, but it functions properly.. it would however be nice if the
device reported such online/offline events, but that could be a
limitation of the hardware.

sd0 at scsibus0 targ 0 lun 0: MATSHITA, LS-120 VER5 00, F527 ATAPI
0/direct removable
sd0: drive offline

-Brynet



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Brynet
Milan Prihoda wrote:
 These drives have 520KByte sector size instead of 512KByte.
 Is there any way how to dump raw data from these drives without
 reformat drive to different sector size ?

Most disks have a sector size of 512 bytes, not kilobytes.

-Brynet



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Milan Prihoda

Brynet wrote:

Milan Prihoda wrote:
  

These drives have 520KByte sector size instead of 512KByte.
Is there any way how to dump raw data from these drives without
reformat drive to different sector size ?



Most disks have a sector size of 512 bytes, not kilobytes.

-Brynet

  

Hi,
i should apologize for incompletely question (with mistakes)
so again (and better :-)

Yes, of course drives have sector size of 520bytes not kilobytes,
it was my typo fail.


# dmesg | grep sd2
sd2 at scsibus0 targ 2 lun 0: IBMAS400, DFHSS4W, 4I4I SCSI2 0/direct fixed
sd2: drive offline

# fdisk sd2
fdisk: sd2: Device not configured

# disklabel sd2
disklabel: /dev/rsd2c: Device not configured

# dd=/dev/rsd2c of=disk1.img
dd: /dev/rsd2c: Device not configured



I tried this drive in a linux box and dmesg told me:
# dmesg | grep sdb
sd 0:0:3:0: [sdb] Unsupported sector size 520.
sd 0:0:3:0: [sdb] 0 512-byte hardware sectors: (0 B/0 B)
sd 0:0:3:0: [sdb] Write Protect is off
sd 0:0:3:0: [sdb] Mode Sense: a7 00 10 08
sd 0:0:3:0: [sdb] Write cache: disabled, read cache: enabled, supports 
DPO and FUA

sd 0:0:3:0: [sdb] Attached SCSI disk

and there i get knowledge about 520byte sector size.

I would like to get raw data from this drive.
Ok - if it's impossible, i want to say it. :-)

Thank. Milan



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Brynet
Hi Milan,

David Vasek was on the right track with his message, it seems likely
that the driver is bailing out on line 1439 in /usr/src/sys/scsi/sd.c.

1423:   /*
1424:* Restrict blksize values to powers of two between 512 and 64k.
1425:*/
1426:   switch (dp-blksize) {
1427:   case 0x200: /* == 512, == DEV_BSIZE on all architectures. */
1428:   case 0x400:
1429:   case 0x800:
1430:   case 0x1000:
1431:   case 0x2000:
1432:   case 0x4000:
1433:   case 0x8000:
1434:   case 0x1:
1435:   break;
1436:   default:
1437:   SC_DEBUG(sd-sc_link, SDEV_DB1,
1438:   (sd_get_parms: bad blksize: %#x\n, dp-blksize));
1439:   return (SDGP_RESULT_OFFLINE);
1440:   }

Adding a special case for 0x208 after 0x200 may let the driver
attach.. this way you can dump the raw data off of the disk.

All bets are off after dumping the data, what file system were you using on it?

-Brynet



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Marco Peereboom
I would love to get my hands on such a drive :-)

EMC uses the same magic; they cram stuff in the additional 8 bytes.

On Thu, Sep 10, 2009 at 06:41:08PM +0200, Milan Prihoda wrote:
 Brynet wrote:
 Milan Prihoda wrote:
   
 These drives have 520KByte sector size instead of 512KByte.
 Is there any way how to dump raw data from these drives without
 reformat drive to different sector size ?
 

 Most disks have a sector size of 512 bytes, not kilobytes.

 -Brynet

   
 Hi,
 i should apologize for incompletely question (with mistakes)
 so again (and better :-)

 Yes, of course drives have sector size of 520bytes not kilobytes,
 it was my typo fail.


 # dmesg | grep sd2
 sd2 at scsibus0 targ 2 lun 0: IBMAS400, DFHSS4W, 4I4I SCSI2 0/direct fixed
 sd2: drive offline

 # fdisk sd2
 fdisk: sd2: Device not configured

 # disklabel sd2
 disklabel: /dev/rsd2c: Device not configured

 # dd=/dev/rsd2c of=disk1.img
 dd: /dev/rsd2c: Device not configured



 I tried this drive in a linux box and dmesg told me:
 # dmesg | grep sdb
 sd 0:0:3:0: [sdb] Unsupported sector size 520.
 sd 0:0:3:0: [sdb] 0 512-byte hardware sectors: (0 B/0 B)
 sd 0:0:3:0: [sdb] Write Protect is off
 sd 0:0:3:0: [sdb] Mode Sense: a7 00 10 08
 sd 0:0:3:0: [sdb] Write cache: disabled, read cache: enabled, supports  
 DPO and FUA
 sd 0:0:3:0: [sdb] Attached SCSI disk

 and there i get knowledge about 520byte sector size.

 I would like to get raw data from this drive.
 Ok - if it's impossible, i want to say it. :-)

 Thank. Milan



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Milan Prihoda

Hi Brynet,
thank You very much for Your idea.
It works :-)

Brynet wrote:

Hi Milan,

David Vasek was on the right track with his message, it seems likely
that the driver is bailing out on line 1439 in /usr/src/sys/scsi/sd.c.

1423:   /*
1424:* Restrict blksize values to powers of two between 512 and 64k.
1425:*/
1426:   switch (dp-blksize) {
1427:   case 0x200: /* == 512, == DEV_BSIZE on all architectures. */
1428:   case 0x400:
1429:   case 0x800:
1430:   case 0x1000:
1431:   case 0x2000:
1432:   case 0x4000:
1433:   case 0x8000:
1434:   case 0x1:
1435:   break;
1436:   default:
1437:   SC_DEBUG(sd-sc_link, SDEV_DB1,
1438:   (sd_get_parms: bad blksize: %#x\n, dp-blksize));
1439:   return (SDGP_RESULT_OFFLINE);
1440:   }

Adding a special case for 0x208 after 0x200 may let the driver
attach.. this way you can dump the raw data off of the disk.

All bets are off after dumping the data, what file system were you using on it?

-Brynet




Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Milan Prihoda

Milan Prihoda wrote:

Hi Brynet,
thank You very much for Your idea.
It works :-)

Brynet wrote:

Hi Milan,

David Vasek was on the right track with his message, it seems likely
that the driver is bailing out on line 1439 in /usr/src/sys/scsi/sd.c.

1423:/*
1424: * Restrict blksize values to powers of two between 512 and 
64k.

1425: */
1426:switch (dp-blksize) {
1427:case 0x200: /* == 512, == DEV_BSIZE on all 
architectures. */

1428:case 0x400:
1429:case 0x800:
1430:case 0x1000:
1431:case 0x2000:
1432:case 0x4000:
1433:case 0x8000:
1434:case 0x1:
1435:break;
1436:default:
1437:SC_DEBUG(sd-sc_link, SDEV_DB1,
1438:(sd_get_parms: bad blksize: %#x\n, dp-blksize));
1439:return (SDGP_RESULT_OFFLINE);
1440:}

Adding a special case for 0x208 after 0x200 may let the driver
attach.. this way you can dump the raw data off of the disk.

All bets are off after dumping the data, what file system were you 
using on it?

I have no idea about filesystem, because these drives are from old
(but risc) as/400 machine. There are four root drives, i dont know, 
in which configuration of raid (if there is smth like raid) they are.

I am just curious.
So again, thank you all.


-Brynet




Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Milan Prihoda

Brynet wrote:

Hi Milan,

I'm glad that it works.. can you post the new attachment message? :)

-Brynet

  

Do you mean this :?

# dmesg | grep sd2
sd2 at scsibus0 targ 2 lun 0: IBMAS400, DFHSS4W, 4I4I SCSI2 0/direct fixed
sd2: 4173MB, 520 bytes/sec, 8414494 sec total



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Brynet
Hi Milan,

I'm glad that it works.. can you post the new attachment message? :)

-Brynet



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Milan Prihoda

Line 1423 and following of /usr/src/sys/scsi/sd.c show that we will
only accept devices with sector sizes that are multiples of 512
(DEV_BSIZE). Others will be impossible to open.

Now, if you delete that code you may be able to open the raw device.
No idea, but I'd be interested in what happens. :-).

DEV_BSIZE of 512 is deeply imbedded in the kernel.

 Ken

  


Hi Ken,
I not deleted any line

# diff -u sd.c-origin sd.c 
--- sd.c-origin Thu Sep 10 21:53:44 2009

+++ sd.cThu Sep 10 20:17:41 2009
@@ -1425,6 +1425,7 @@
*/
   switch (dp-blksize) {
   case 0x200: /* == 512, == DEV_BSIZE on all architectures. */
+   case 0x208:
   case 0x400:
   case 0x800:
   case 0x1000:


and now,
# dd if=/dev/rsd2c of=disk1.img bs=520

works for me :-)



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Kenneth R Westerback
On Thu, Sep 10, 2009 at 06:41:08PM +0200, Milan Prihoda wrote:
 Brynet wrote:
 Milan Prihoda wrote:
 These drives have 520KByte sector size instead of 512KByte.
 Is there any way how to dump raw data from these drives without
 reformat drive to different sector size ?
 
 Most disks have a sector size of 512 bytes, not kilobytes.
 
 -Brynet
 
 Hi,
 i should apologize for incompletely question (with mistakes)
 so again (and better :-)
 
 Yes, of course drives have sector size of 520bytes not kilobytes,
 it was my typo fail.
 
 
 # dmesg | grep sd2
 sd2 at scsibus0 targ 2 lun 0: IBMAS400, DFHSS4W, 4I4I SCSI2 0/direct fixed
 sd2: drive offline

Line 1423 and following of /usr/src/sys/scsi/sd.c show that we will
only accept devices with sector sizes that are multiples of 512
(DEV_BSIZE). Others will be impossible to open.

Now, if you delete that code you may be able to open the raw device.
No idea, but I'd be interested in what happens. :-).

DEV_BSIZE of 512 is deeply imbedded in the kernel.

 Ken

 
 # fdisk sd2
 fdisk: sd2: Device not configured
 
 # disklabel sd2
 disklabel: /dev/rsd2c: Device not configured
 
 # dd=/dev/rsd2c of=disk1.img
 dd: /dev/rsd2c: Device not configured
 
 
 
 I tried this drive in a linux box and dmesg told me:
 # dmesg | grep sdb
 sd 0:0:3:0: [sdb] Unsupported sector size 520.
 sd 0:0:3:0: [sdb] 0 512-byte hardware sectors: (0 B/0 B)
 sd 0:0:3:0: [sdb] Write Protect is off
 sd 0:0:3:0: [sdb] Mode Sense: a7 00 10 08
 sd 0:0:3:0: [sdb] Write cache: disabled, read cache: enabled,
 supports DPO and FUA
 sd 0:0:3:0: [sdb] Attached SCSI disk
 
 and there i get knowledge about 520byte sector size.
 
 I would like to get raw data from this drive.
 Ok - if it's impossible, i want to say it. :-)
 
 Thank. Milan



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Marco Peereboom
There are a million spots where 512 is hard coded...

On Thu, Sep 10, 2009 at 10:03:07PM +0200, Milan Prihoda wrote:
 Line 1423 and following of /usr/src/sys/scsi/sd.c show that we will
 only accept devices with sector sizes that are multiples of 512
 (DEV_BSIZE). Others will be impossible to open.

 Now, if you delete that code you may be able to open the raw device.
 No idea, but I'd be interested in what happens. :-).

 DEV_BSIZE of 512 is deeply imbedded in the kernel.

  Ken

   

 Hi Ken,
 I not deleted any line

 # diff -u sd.c-origin sd.c --- sd.c-origin Thu Sep 10 21:53:44 2009
 +++ sd.cThu Sep 10 20:17:41 2009
 @@ -1425,6 +1425,7 @@
 */
switch (dp-blksize) {
case 0x200: /* == 512, == DEV_BSIZE on all architectures. */
 +   case 0x208:
case 0x400:
case 0x800:
case 0x1000:


 and now,
 # dd if=/dev/rsd2c of=disk1.img bs=520

 works for me :-)



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread Jon Simola
On Thu, Sep 10, 2009 at 10:46 AM, Marco Peereboom sl...@peereboom.us wrote:
 I would love to get my hands on such a drive :-)

 EMC uses the same magic; they cram stuff in the additional 8 bytes.

I inherited a couple of shelves from an old EMC setup, and ended up
using Seagate's SeaTools Enterprise Edition to reformat them from 520
to 512 byte sectors. It looks like it can do 512, 520, 1024, or user
defined bytes per block.

If you actually want one, I've got some old 9GB 80pin Seagate Cheetahs
I could convert, or I might even have one of the 36GB FibreChannel
drives from the EMC shelf that wasn't converted.

As an aside, I used a shelf with ten of the 36GB drives to see if they
would be reasonably useful as a softraid set. Worked great, but the
operating cost would have been about $200/year

-- 
Jon



Re: IBM 520KByte sector size scsi drives

2009-09-10 Thread David Vasek

On Thu, 10 Sep 2009, Milan Prihoda wrote:


and now,
# dd if=/dev/rsd2c of=disk1.img bs=520

works for me :-)


Are you sure you are getting all 520 bytes from each sector and not only 
first 512 bytes? Can you verify it?


Regards,
David