From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96075324106717.tru64-unix-managers.marc@archive.invalid> From: luis () itzamn ! ath ! epa ! gov Date: Tue, 24 Oct 1995 16:14:03 +0000 To: tru64-unix-managers Subject: SUMMARY: problems with /dev/nrmt0h X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96075324106717 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) 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 Michael Matthews Craig Hagan Hellebo Knut "Dr. Tom Blinn, 603-881-0646" Jon Buchanan Gyula Szokoly gosejac@rto.dec.com olle@cb.uu.se (Olle Eriksson) jmh@rto.dec.com (Jan Mark Holzer) "Edward C. Bailey" bernards@ecn.nl (Marcel A. Bernards) Kurt Carlson I have cut and paste responses to provide continuity. All errors are mine. Thank you very much for your responses. Luis (luis@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 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 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 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 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@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 (your tape model) . >> # cd /dev >> # rm *rmt0* >> This deletes the old/bogus entries >> # ./MAKEDEV tz >> To recreate the tape drive entries you would just execute the >> MAKEDEV script with the tapedrive entry as the first parameter . >> >>> Kurt Carlson 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@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@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--