[geeks] Raw disk access under Solaris

JP Hindin jplist2008 at kiwigeek.com
Fri Sep 16 13:04:29 CDT 2016


I'm going to break protocol and top-post because I don't have much to say. 
Wow, thanks Jonathan, I really appreciate the research you put in below. I 
believe I'm going to take your advice and try something else. I burned a 
copy of SparcLinux yesterday (I'm more famaliar with Linux than BSD). I'll 
also go back over the Cray manuals and see if I can identify the block 
size.

Thank you _very_ much.

  - JP


On Fri, 16 Sep 2016, Jonathan Patschke wrote:

> On Thu, 15 Sep 2016, JP Hindin wrote:
>
>> My understanding is the blocksize of the filesystem is irrelevant - I'm
>> doing a raw copy (or, rather, I'm _attempting_) and effectively all I'm
>> asking is for the disk to feed the bytes directly from sector 0 right
>> through until the last sector.
>
> I wouldn't be so sure about that.
>
>  https://github.com/OpenIndiana/illumos-gate/blob/master/usr/src/uts/common/io/scsi/targets/sd.c
>
> Near line 30620:
>
>  * 5. Supported blocksizes of target devices
>  *
>  *     Sd supports non-512-byte blocksize for removable media devices only.
>  *     For other devices, only 512-byte blocksize is supported. This may be
>  *     changed in near future because some RAID devices require non-512-byte
>  *     blocksize
>
> Disks don't serve bytes; they serve blocks.
>
>> So as I was saying, _format_ uses: 
>> /devices/sbus at 1f,0/QLGC,isp at 3,10000/sd1,0
>> 
>> Great, raw disk, no partitions? Eeeeexcept this doesn't exist.
>
> Nope, it doesn't.  Code in usr/src/cmd/format/startup.c truncates device
> names at the first colon.  You're seeing a pretty-printed version of the
> device name.
>
>> So I still have no idea how on earth 'format' does its magic.
>
> Reading the source for format (in usr/src/cmd/format/startup.c) indicates
> that it just calls open() on the device (specifically, the *s2 slice),
> leaving the kernel to handle the details.  If that fails, code in
> auto_sense.c will issue a generic SCSI command to guess the disk geometry
> to build a pseudo-VTOC for format's use.
>
> Note also the comment just above there (in the kernel source) where it
> says the sd driver creates an in-memory default VTOC if none is present on
> disk, provided you're using x86.  Since you're on SPARC, you don't get
> this benefit.
>
> This says to me that you probably need to use another platform to solve
> this problem.  Try netbooting a BSD and see if you can dd the raw device
> to /dev/null just to exercise it.  If that fails, you probably have a
> strange block size.
>
> -- 
> Jonathan Patschke
> Austin, TX
> USA
> _______________________________________________
> GEEKS:  http://www.sunhelp.org/mailman/listinfo/geeks


More information about the geeks mailing list