LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-20-2004, 11:59 PM   #1
e1000
Member
 
Registered: Oct 2003
Location: California
Distribution: Ubuntu
Posts: 582

Rep: Reputation: 30
trying to understand /dev


I am in the process of trying to make a bootable CD distro and one of the initrd's tasks is to locate the CD drive so it can set up the loopback filesystem that will be the root fs.

my biggest problem is that i dont truely understand the /dev/ directory enough to use it. and of course knowing this is intregral for the task of finding my cdrom drive automatically.

when i search on the /dev directory i get all sorts of breif newb oriented pages, but i need an in depth tut on it and how to use it, does anyone know where i can find this? also, would using the devfs under the kernel be easier or will i still need to know about the /dev stuf?
 
Old 02-21-2004, 07:10 AM   #2
LinuxBlackBox
Member
 
Registered: Sep 2003
Location: Canada
Distribution: Slackware 9
Posts: 243

Rep: Reputation: 30
What do you want to know, exactly? The /dev/ directory is where all of the hardware that your computer is configured to use is stored. Linux uses everything on the system as a file, including hardware. The cd drive would probably be /dev/cdrom.
 
Old 02-21-2004, 02:15 PM   #3
e1000
Member
 
Registered: Oct 2003
Location: California
Distribution: Ubuntu
Posts: 582

Original Poster
Rep: Reputation: 30
do me a favor, type "ls -l /dev/cdrom"; /dev/cdrom is not a device but its a link to the real cdrom device which us usually designated as /dev/hd*, the scripts job would be to find the real cdrom then set up the real root filesystem image as a /dev/loop* so that it could be mounted.

what i dont understand is the mechanics of stuf like "mknod" and what the "major" and "minor" numbers are, and im sure that's inportant to what i need to do, and at the verry least it would be usefull to know what they are and how to use them.
 
Old 02-21-2004, 07:06 PM   #4
Darktyco
Member
 
Registered: Aug 2003
Location: michigan
Distribution: slackware
Posts: 59

Rep: Reputation: 15
Why can't your script follow the soft link?

Device major/minor numbers are identifiers for devices. For an example look in the file /proc/stat at the disk_io line. The first numbers in parenthesis are the major and minor numbers of all the disks in your system. Eg disk_io: (3,0): (92,92,113,0,0) (3,1): (38582,9146,261475,29436,388120)
 
Old 02-22-2004, 01:47 AM   #5
e1000
Member
 
Registered: Oct 2003
Location: California
Distribution: Ubuntu
Posts: 582

Original Poster
Rep: Reputation: 30
Why can't your script follow the soft link?

im not designing it for my machine, if i was it would be so much easier cause i already know what my cdrom drives designation is. im trying to make this work on any ide based system.

hopefully one of the things my script can do is make a symlink to /dev/cdrom
 
Old 02-22-2004, 03:17 AM   #6
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Have you read The Bootdisk HOWTO? That has some good information on setting up a basic Linux filesystem. Even though it is written for a floppy it still is relevant for a cdrom bootdisk.

The file devices.txt is the file I use when I want to know the major/minor of a device, it comes with the kernel sources, so you should have one at:
/usr/src/linux/Documentation/devices.txt

As far as mknod goes it's real simple to use, you just need to know the major/minor number of the device and whether it is a character or block device.
 
Old 02-22-2004, 06:11 AM   #7
farmerdan
Member
 
Registered: Feb 2004
Location: IA-MO State Line
Distribution: Ubuntu 10.04
Posts: 59

Rep: Reputation: 15
Hello, e1000,

I just finished project that took me deeply into understanding /dev/xxxx. I posted what I did in the "Success Stories" forum, here

The story may not be interesting to you but I found some articles that talked about /dev/ and helped me learn what info I had there and how it worked. I provided links to the articles.

Yesterday, I'm running Mandrake 9.2, I discoverd that some of the articles I referenced were installed on my hard drive , in, off all places, a directory called HOWTO.

There's another reference that I found quite helpful. I think the name of it is "Introduction to Linux." It has a great discussion on the file system. I don't have great conficence in the accuracy of this link, but you can try it here.

Good luck.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I cannot access EITHER CD drive! And there's no /dev/hdc or /dev/hdd or /dev/cdrom! Dmalic Linux - Hardware 13 11-18-2005 07:11 PM
ln: creating symbolic link `/dev/dvd' to `/dev/hdc': Permission denied qazwsx27 Fedora 3 06-14-2005 02:09 PM
How can I boot either one of my hard drives /dev/hda or /dev/hdb, I have RH9 and FC2 omogunkristi Linux - General 1 06-21-2004 05:11 AM
Sandisk USB card Reader not linking /dev/sg0 to /dev/sda acidraven Linux - Hardware 1 06-19-2004 03:56 PM
mounting 2 ide-scsi devices /dev/cdrom and /dev/cdrom1 issue penguin123 Linux - Hardware 3 09-26-2003 08:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration