Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
# raw -qa /dev/raw/raw1: bound to major 8, minor 17 /dev/raw/raw2: bound to major 8, minor 33 /dev/raw/raw3: bound to major 8, minor 49 /dev/raw/raw4: bound to major 8, minor 65
PHP Code:
# ls -l /dev/* | grep '8, 17' brw-rw---- 1 root disk 8, 17 Jan 30 16:16 /dev/sdb1 # ls -l /dev/* | grep '8, 33' brw-rw---- 1 root disk 8, 33 Jan 30 16:16 /dev/sdc1
I tried following options - but got error
PHP Code:
# ls -l /dev/* | grep '8, 17','8, 33' # ls -l /dev/* | grep '8, 17'| grep '8, 33' # ls -l /dev/* | grep '8, 17', grep '8, 33' grep: grep: No such file or directory grep: 8, 33: No such file or directory
Using fdisk operation i have created some partitions.
Using raw utility i bound raw devices with block devices.
Ex : raw /dev/raw/raw1 /dev/sdb1
# raw -qa
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2: bound to major 8, minor 33
/dev/raw/raw3: bound to major 8, minor 49
/dev/raw/raw4: bound to major 8, minor 65
Here my confusions
What indicates major/minor number for a device ? I read linux treating each device as a file - Why so ? Why linux treats /dev/raw/raw1 as a file instead of SCSI disk ?
Actually /dev/sdb1 is bound with /dev/raw/raw1 using raw utility.
Using fdisk operation i have created some partitions.
Using raw utility i bound raw devices with block devices.
Ex : raw /dev/raw/raw1 /dev/sdb1
# raw -qa
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2: bound to major 8, minor 33
/dev/raw/raw3: bound to major 8, minor 49
/dev/raw/raw4: bound to major 8, minor 65
Waste of time. Just use the block devices directly. You get identical performance.
Quote:
Here my confusions
What indicates major/minor number for a device ?
Nothing. Linux only provides them for some legacy operations. If you actually look you find that the device name is dynamically generated, but the major/minor numbers are not used. ORIGINALLY, the major number was the index in the driver tables that corresponded to pointers to the driver functions. The minor number was provided to the driver functions to identify which unit to use. Unfortunately (and a LONG time ago) these indexes became useless (too many different kinds of drivers, some with too many units).
Quote:
I read linux treating each device as a file - Why so ?
simplicity. All the file name entry does is identify which driver to use for various functions. Current linux design has the /dev directory as a pseudo filesystem - it doesn't really exist. The in memory data structures are being interpreted as a filesystem, and the device structure (a collection of pointers to the driver functions) are assigned to a name during the initial hardware scan. That is why the filesystem type is "devtmpfs". It isn't a real filesystem. As each driver initializes it registers itself to the kernel devtmpfs filesystem which records the appropriate entry.
Quote:
Why linux treats /dev/raw/raw1 as a file instead of SCSI disk ?
Everything is a file... There is no difference between /dev/raw/raw1 and using the /dev names.
Quote:
Actually /dev/sdb1 is bound with /dev/raw/raw1 using raw utility.
So what. Both names are linked to the same device driver. This was one of the reasons the raw interface was considered to be redundant and could be dropped.
If you actually look, the /dev/disk directory entries (by-id, by-label, by-partuuid, by-path, and by-uuid) just supply symbolic links the base /dev/<name> for the disk. I believe the /dev/raw entries are the same.
If you use the raw entries, you have additional restrictions - you have to use block aligned data transfers (and use page aligned memory buffers)... and that slows down and makes things more complicated for the application. Letting the kernel handling the buffers makes for a faster and more flexible operation by letting the page cache handle the I/O scheduling.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.