FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 11-06-2008, 02:31 PM
"Umarzuki Mochlis"
 
Default Block device, major- minor ?

$ mknod block-device b 8 68

can somebody explains why do we need major and minor in creating a device file like above?
--
Regards,

Umarzuki Mochlis
http://gameornot.net
 
Old 11-06-2008, 02:35 PM
Eduardo M KALINOWSKI
 
Default Block device, major- minor ?

Umarzuki Mochlis escreveu:
> $ mknod block-device b 8 68
>
> can somebody explains why do we need major and minor in creating a
> device file like above?

Basically for the same reason one needs both the street name and the
house number to locate a house in a city.

--
Eduardo M Kalinowski
eduardo@kalinowski.com.br


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 11-06-2008, 04:28 PM
Roger Leigh
 
Default Block device, major- minor ?

On Thu, Nov 06, 2008 at 01:35:02PM -0200, Eduardo M KALINOWSKI wrote:
> Umarzuki Mochlis escreveu:
> > $ mknod block-device b 8 68
> >
> > can somebody explains why do we need major and minor in creating a
> > device file like above?
>
> Basically for the same reason one needs both the street name and the
> house number to locate a house in a city.

The reason is historical. Inside the kernel they are just a single
number, from which the "major" and "minor" parts can be extracted.

When devices had numbers statically allocated, so a disc drive
would have a major number, with partitions as minor numbers (for
example), they had a purpose. Today, where the device numbers
are dynamically allocated and we use udev (previously devfs) to
attach names to the numbers, the major and minor separation has
little meaning. Currently there is a mixture of both static
names (older devices, for compatibility) and dynamic:

% ls -ld /dev/hda* /dev/mapper/* /dev/usb/*
brw-rw---- 1 root disk 3, 0 2008-11-06 12:51 /dev/hda
brw-rw---- 1 root disk 3, 1 2008-11-06 12:51 /dev/hda1
brw-rw---- 1 root disk 3, 2 2008-11-06 12:51 /dev/hda2
brw-rw---- 1 root disk 3, 3 2008-11-06 12:51 /dev/hda3
brw-rw---- 1 root disk 3, 4 2008-11-06 12:51 /dev/hda4
brw-rw---- 1 root disk 3, 5 2008-11-06 12:51 /dev/hda5
crw-rw---- 1 root root 10, 60 2008-11-06 12:51 /dev/mapper/control
brw-rw---- 1 root disk 254, 4 2008-11-06 12:51 /dev/mapper/hardknott-home
brw-rw---- 1 root disk 254, 0 2008-11-06 12:51 /dev/mapper/hardknott-root
brw-rw---- 1 root disk 254, 5 2008-11-06 12:51 /dev/mapper/hardknott-sbuild--chroots
brw-rw---- 1 root disk 254, 3 2008-11-06 12:51 /dev/mapper/hardknott-swap
brw-rw---- 1 root disk 254, 1 2008-11-06 12:51 /dev/mapper/hardknott-usr
brw-rw---- 1 root disk 254, 2 2008-11-06 12:51 /dev/mapper/hardknott-var
crw-rw---- 1 root root 180, 0 2008-11-06 12:51 /dev/usb/hiddev0

In this case, the hard disc and its partitions are all on
block-major-3. The LVM volumes are all on block-major-254, but the
partitions have a (semi-)random minor device number, depending on
the order they get discovered/registered in.


Regards,
Roger

--
.'`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
 

Thread Tools




All times are GMT. The time now is 10:01 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org