The question was how to write to a raw device.
simple answer: just open the device in /dev/rdsk with open(), seek() and
write() to it. There also is the ioctl() routine. prtvtoc and format can
be used to find out about the disk size and slices.
Thanks to all the people who responded:
Richard Cooper ( who's disk performance benchmark code gave me the clue
of not writing to block 0 )
Matt Reynolds
David Thorburn-Gundlach (who told me to look at the code of scsiinfo)
Daniel Kluge
Milton Larson
Brion Leary
and others ...
Also thanks to the few who told me that I should do my homework myself.
In fact its not my homework. A professor here wanted to use a disk for
database experiments with a group of postgrads. I was asked to give them
access to the drive, so I just changed the group of the raw-device and did
a 'chmod g+rw'. I thought that _they_ would know how to access the drive.
He's a prof after all *grin*
One of the students then wrote over block 0 of the disk (were the
disk label, ie. partition table is), and of course suddenly nobody had
access to it. Solution: they now use a slice that does not include
cylinder 0. I wrote the mail to the list, because I was not sure that I
had not overlooked some critical information. I checked the list-archives
before I wrote the mail btw. Those who think that the mail should not
have been sent to the list, please accept my apologies.
Benno
--------------------------------------------------------------------------
- Sebastian Benoit
- benoit@mathematik.uni-marburg.de
- http://www.mathematik.uni-marburg.de/~benoit
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:39 CDT