question about devices and block numbers

DJ Lucas dj_me at swbell.net
Thu Nov 14 14:18:55 PST 2002


Steven Stimpson wrote:
> hello and thank you for reading this. someone on this lsit suggested
> to read the devices file in the linux documentation to get a better
> understanding of devices.

unt uhm *clears throat*, Me. lol

>
>
>  3 char Pseudo-TTY slaves
>                   0 = /dev/ttyp0        First PTY slave
>                   1 = /dev/ttyp1        Second PTY slave
>                     ...
>                 255 = /dev/ttyef        256th PTY slave
>
>                 These are the old-style (BSD) PTY devices; Unix98
>                 devices are on major 136 and above.
>
>     block       First MFM, RLL and IDE hard disk/CD-ROM interface
>                   0 = /dev/hda          Master: whole disk (or CD-ROM)
>                  64 = /dev/hdb          Slave: whole disk (or CD-ROM)
>
>                 For partitions, add to the whole disk device number:
>                   0 = /dev/hd?          Whole disk
>                   1 = /dev/hd?1         First partition
>                   2 = /dev/hd?2         Second partition
>                     ...
>                  63 = /dev/hd?63        63rd partition
>
>  Notice how it says 3 in the upper left hand coorner. so does that
> mean if I wanted to mknod the 63rd partition they talk about i would
> do mknod b 3 63? Or does the three just refer to the fact that this
> is the third paragraph? thanks for any info for the newbies...
> STeven

And yes, your example is sorta correct except you didn't provide a
device name.  This will be the same throught devices.txt.  However, the
explanation of this particular section avove is kinda goofy and may need
a bit more explanation. (or not, but somebody might find this on the
archives someday ;-) ) To re-quote the relevant part:

>                 For partitions, add to the whole disk device number:
>                   0 = /dev/hd?          Whole disk
>                   1 = /dev/hd?1         First partition
>                   2 = /dev/hd?2         Second partition
>                     ...
>                  63 = /dev/hd?63        63rd partition

Sooo, if it's the 63rd partition on /dev/hda, you'd first need to create
/dev/hda (this should already be there with lfs) with this command
'mknod /dev/hda b 3 0'.  Then create the partition with 'mknod
/dev/hda63 b 3 63'.  If this were on /dev/hdb, you'd need to create
/dev/hdb first, with 'mknod /dev/hdb b 3 64' and then create /dev/hdb63
with 'mknod /dev/hdb63 b 3 127'.  The 127 comes from the minor numbr of
the drive (64) + (63) the partition number.  you can actually use any
naming convention you'd like for your devices although it's usually
better to stick to the standard device names, and if you want other
(easier to remember) names, use symlinks.

Hope that helps,

DJ


-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe blfs-support' in the subject header of the message



More information about the blfs-support mailing list