raw disk I/O using Solaris 2.6

raw disk I/O using Solaris 2.6

Post by Arunprasad P. Marat » Mon, 13 Mar 2000 04:00:00



I would like to do raw disk I/O on a Sun Ultra 5 machine
with SunOS 5.6 (Solaris 2.6) operating system. I want to
do raw disk I/O because I want to avoid using buffer
cache. (I would like to perform some experiments with and
without using buffer cache to study some effects.)

I have read some man pages. There seem to be several relevant
system calls: read (section 2 of the man pages), read (section
9E of the man pages), physio, aphysio, aread, and so on.

My question is: does anybody know how to do it? Can you
provide me with an example? Is there an FAQ regarding this?
Any information that you provide will be helpful.

Please email me your suggestions in addition to posting them.

Thanks,

Arun

 
 
 

raw disk I/O using Solaris 2.6

Post by Steve » Mon, 13 Mar 2000 04:00:00




>I would like to do raw disk I/O on a Sun Ultra 5 machine
>with SunOS 5.6 (Solaris 2.6) operating system. I want to
>do raw disk I/O because I want to avoid using buffer
>cache. (I would like to perform some experiments with and
>without using buffer cache to study some effects.)

>I have read some man pages. There seem to be several relevant
>system calls: read (section 2 of the man pages), read (section
>9E of the man pages), physio, aphysio, aread, and so on.

>My question is: does anybody know how to do it? Can you
>provide me with an example? Is there an FAQ regarding this?
>Any information that you provide will be helpful.

>Please email me your suggestions in addition to posting them.

>Thanks,

>Arun

Depends on how deep you want to take it.  physio() is a kernel routine
almost exclusively called from device drivers (hard disk, optical disk
etc) and is not accessible from a user program.. Are you really
looking to write a device driver for this? Sounds a bit too low level
for what you want to do. If so though, you'll need more than just a
few pointers. It's a field of programming in it's own right. I used to
write them and they're a pig to get right.

A quick and dirty way of doing your experiments would be to just
create your partition and use the dd command to read and write from
it. There should be a block device filename and a raw device filename
for the partition. Use dd on each of these files, time it, and compare
results.

Otherwise, if you want to write a program to do it, then just use the
ordinary open (with O_SYNC set maybe to be sure in the case of raw),
read, write, close calls but open the block device name to access it
via the buffer cache, and use the raw device name for the other way.

Sorry, I'm not a Solaris guy and I don't know where in /dev the files
are held or the naming conventions etc. Maybe someone else could help
with that.

Hope I've understood your request and that this helps a little.

 
 
 

raw disk I/O using Solaris 2.6

Post by Oscar Goosen » Mon, 13 Mar 2000 04:00:00


If all you want is to disable buffercache you can do that  with
the -forcedirectio (or something like that)
option of mount. see man page mount
No need for raw disk i/o
oscar goosens


Quote:>I would like to do raw disk I/O on a Sun Ultra 5 machine
>with SunOS 5.6 (Solaris 2.6) operating system. I want to
>do raw disk I/O because I want to avoid using buffer
>cache.

 
 
 

1. can't read Solaris 2.6 x86 hard disk on Solaris 2.6 Ultra-1 ?!?

I was going to use this hard drive to move large files from my
Ultra to my Pentium PC for CD-R backup, but upon "boot -r" on
the Ultra I saw an error about "invalid geometry" on sd3, the
drive I had formatted on my PC to be ufs.  And now of course
I can't even "prtvtoc" this disk ("Unable to read Disk geometry"),
so mounting it is seemingly out of the question.

What's the problem?  Was I naive to assume the a ufs on a Solaris
system would be the same regardless of CPU type?  I really don't
want to use Ethernet to transmit potentially gigabytes of data
on a regular basis :-(...

Please reply via email (and post here, of course), as I don't
get a chance to keep up with the newsgroup as regularly as I
would wish.  Thanks.

--
--
Mark J. Kaufman             Sun Microsystems, San Diego

2. freezing samba

3. raw patitiion error after Sybase 11.5 installation in Solaris 2.6

4. Failed PPP under Solaris 2.5.1 x86

5. Solaris 2.6 recvfrom() with a raw socket...

6. IP masquerading, Net Games, and Mandrake 7.2

7. Can software compiled for Solaris 2.5 be used in Solaris 2.6?

8. Amoeba 5.2 now available by FTP for universities

9. Upgrade from Solaris 2.6 with Volume Manager 2.6 to Solaris 8 with Volume Manager 3.2

10. Ignorign Floppy disk errors or Raw-Read Raw-Write

11. Raw disk access and the 'raw' program

12. Breaking a mirrored disk on Solaris 2.6

13. How could I know the available space disk on a Sun Microsystem running under solaris 2.6 ?