Original question:
>
> /dev/nrmt0h suddenly became a regular file, as opposed to
> "character special ..." (we are now in the process of determining
> how this happened). The device was reconstructed by using "mknod",
> the major and minor device numbers gotten from a similar machine on
> our site. My questions are:
>
> a. in general, how can the major and minor device numbers be determined?
>
> b. is there a script/utility in digital unix that automatically creates
> these devices ?
>
> The system is a dec axp 3000/900, running digital unix 3.2c
> $ uname -a
> OSF1 itzamn.ath.epa.gov V3.2 148 alpha
>
The short answers are:
a. device numbers cannot be determined in general, and
b. use MAKEDEV
(See below for details.)
Several persons noted that device numbers can be obtained from "ls" but,
if the device is not there (or improperly set) then the information is
incorrect.
Also, look at the SCSI(7) man page. (Edward C. Bailey<ed_at_moocow.niehs.nih.gov>)
It became evident from the responses that it is not necessary to know
the device numbers; MAKEDEV takes care of the details.
My thanks to (in no particular order):
Donald L. Ritchey <dritchey_at_cecc.chi.gov>
Michael Matthews <matthewm_at_sgate.com>
Craig Hagan <hagan_at_rmc1.crocker.com>
Hellebo Knut <Knut.Hellebo_at_nho.hydro.com>
"Dr. Tom Blinn, 603-881-0646" <tpb_at_zk3.dec.com>
Jon Buchanan <Jonathan.Buchanan_at_ska.com>
Gyula Szokoly <szgyula_at_skysrv.Pha.Jhu.EDU>
gosejac_at_rto.dec.com
olle_at_cb.uu.se (Olle Eriksson)
jmh_at_rto.dec.com (Jan Mark Holzer)
"Edward C. Bailey" <ed_at_moocow.niehs.nih.gov>
bernards_at_ecn.nl (Marcel A. Bernards)
Kurt Carlson <SXKAC_at_orca.alaska.edu>
I have cut and paste responses to provide continuity.
All errors are mine.
Thank you very much for your responses.
Luis (luis_at_itzamn.ath.epa.gov).
>>> Dr. Thomas P. Blinn, UNIX Software Group,
>>> Digital Equipment Corporation wrote:
> a. in general, how can the mayor and minor device numbers be determined?
>> With some difficulty. In fact, they aren't necessarily "hard wired",
>> since there is support for adding device drivers dynamically, and with
>> dynamically added device drivers, the major number can "float" from
>> re-boot to re-boot. The minor numbers are selected by the device driver
>> designer, no according to any standard rule.
> b. is there a script/utility in digital unix that automatically creates
> these devices ?
>> Yes. In /dev there is a file called MAKEDEV that is a shell script
>> that can be used to create device special names for all the standard
>> supported devices that have static drivers in the distributed Digital
>> UNIX. (It does not create the device names for things like STREAMS
>> devices, which are set up on the fly during the initialization of the
>> STREAMS subsystem.) To use it, connect to the /dev directory as root
>> and run ./MAKEDEV passing names of devices (or device groups) as the
>> arguments. (For a tape device, you need to pass the tznn style name,
>> not the rmt style name.)
>>> Don Ritchey <dritchey_at_chipsi.com> wrote:
> Depending on how many tape devices you have and what their SCSI
> addresses are, you run the /dev/MAKEDEV script with the name of the
> tape device from what you see at boot time. E.g., if your tape is a
> TLZ06 (4mm DAT drive) on SCSI address 4, then you do the following and
> you are back in business:
> cd /dev
> ./MAKEDEV tz4
> (of course, you do this as root.)
>>> Craig Hagan <hagan_at_rmc1.crocker.com> wrote
in general,
> cd /dev
> ./MAKEDEV tz?
>
> where ? is the id of the tape drive
> 0-7 is the internal (first) scsi bus, 8-15 the external (second), etc etc.
>
>>> Hellebo Knut <Knut.Hellebo_at_nho.hydro.com> wrote:
> If you have installed your tape with target id 2 and it is attached to the
> internal bus it is tz2 (the formula: id=target# + 8*cntrl#).
> Do 'cd /dev;./MAKEDEV tz2' and you're home.
>>> Jon Buchanan <Jonathan.Buchanan_at_ska.com> wrote:
> [snip]
> Otherwise, copying from one machine to another is fine as long as the
> kernels are configured identically and the devices have the same SCSI ids.
>>> jmh_at_rto.dec.com (Jan Mark Holzer) wrote
>> you can easily reconstruct any device on your system by
>> using the MAKEDEV script in /dev .
>> To reconstruct your tape you could have typed the following
>> commands :
>>
>> # uerf -r 300 -R | more
>> this will give you a list of the boot messages in reverse order
>> and from the first entry you would pick the entry which reads
>> something like tz<somenumber> (your tape model) .
>> # cd /dev
>> # rm *rmt0*
>> This deletes the old/bogus entries
>> # ./MAKEDEV tz<thenumberfromuerf>
>> To recreate the tape drive entries you would just execute the
>> MAKEDEV script with the tapedrive entry as the first parameter .
>>
>>> Kurt Carlson <SXKAC_at_orca.alaska.edu> wrote:
> a. in general, how can the mayor and minor device numbers be determined?
a discussion i recently sent to somebody else i'll attach.
______________________________________________________________________________
the size numbers are major,minor from the following (this tape was
created with mknod commands):
sxkac_at_java> ls -l /dev/*mt1*
crw-rw-rw- 1 root system 9,6151 Sep 7 12:23 /dev/nrmt1a
crw-rw-rw- 1 root system 9,6147 Sep 7 12:23 /dev/nrmt1h
crw-rw-rw- 1 root system 9,6145 Sep 7 12:23 /dev/nrmt1l
crw-rw-rw- 1 root system 9,6149 Sep 7 12:23 /dev/nrmt1m
crw-rw-rw- 1 root system 9,6150 Sep 7 12:23 /dev/rmt1a
crw-rw-rw- 1 root system 9,6146 Sep 7 11:53 /dev/rmt1h
crw-rw-rw- 1 root system 9,6144 Sep 7 12:23 /dev/rmt1l
crw-rw-rw- 1 root system 9,6148 Sep 7 12:23 /dev/rmt1m
That is bus 0 target 6, likely always lun 0 for tapes.
I'm not sure of why rmt?l gets the first numeric assignment, but
it's consistant in how they assign them for tapes. Use character
(not block) for tapes.
The formulas (and an hsz disk example):
root_at_spike> cat ~sxkac/examples/mknod.301
# Naming convention (find info from 'scu show edt'):
#
# device = r[r]z((bus# * 8) + target#)(LUN#)(partition#)
# minor# = ((bus# * 16384) + (target# * 1024) + (LUN# * 64))
# major# = 8 for disk (9 for tape)
# then: mknod device (b | c) major# minor#
#
# Example (for device d301 on hsz-2):
# =======
# Glacier: rz(6*8+3)(1) == rz511
# scsi6, id=3 (from hsz-2 id=(3,4)
# minor (6*16384 + 3*1024 + 1*64) == 101440
# Nugget: rz(1*8+3)(1) == rz111
# (|Spike) scsi1, id=3
# minor (1*16384 + 3*1024 + 1*64) == 19520
#==============================================================================
mknod /dev/rrz111a c 8 19520
mknod /dev/rrz111b c 8 19521
mknod /dev/rrz111c c 8 19522
mknod /dev/rrz111d c 8 19523
mknod /dev/rrz111e c 8 19524
mknod /dev/rrz111f c 8 19525
mknod /dev/rrz111g c 8 19526
mknod /dev/rrz111h c 8 19527
#
mknod /dev/rz111a b 8 19520
mknod /dev/rz111b b 8 19521
mknod /dev/rz111c b 8 19522
mknod /dev/rz111d b 8 19523
mknod /dev/rz111e b 8 19524
mknod /dev/rz111f b 8 19525
mknod /dev/rz111g b 8 19526
mknod /dev/rz111h b 8 19527
#
# disklabel -rw /dev/rrz111c hsz40 # only on 1st system
disklabel -r /dev/rrz111c
______________________________________________________________________________
--end-of-SUMMARY--
Received on Tue Oct 24 1995 - 17:51:43 NZDT