LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-17-2005, 06:54 AM   #1
cfcmark
LQ Newbie
 
Registered: Jun 2004
Posts: 5

Rep: Reputation: 0
The mechanics of Unix devices


I have no friendly unix admin expert to ask and I'm going cross eyed looking for info on the interworld webnet so I thought I'd give you guys a chance to dazzle with your expertise. I want to understand how a unix system, (Linux in my case), goes through the mechanics of recognising and attaching a disk drive. I've read a lot about the special files in /dev and their major and minor numbers. I thought I'd worked it out when I read that the major number identifies the driver for the specific device and the minor number the commumication port but then I realised that this also relates to partitions on single disks. Can anyone point me at or give me a difinitive explanation of what's going on, how the various bits and pieces bolt together? Cheers.
 
Old 03-17-2005, 07:23 AM   #2
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
/dev/hda = master disk on 1st IDE
hdb = slave disk on 1st IDE
hdc = master on 2nd IDE
hdd = slave on 2nd IDE

That's the physical discs. Partitions add another number, so
hda1 = first partition on 1st master hard drive
hda2 = second partition on 1st master hard drive
hdb1 = first partition on 1st slave hard drive

Then you get the SCSI ones, but the basic convention is the same:
/dev/?? = basic device name - hd, sa, sd, etc
a,b,c,etc = order in which the devices are found
1,2,3,etc = partitions on the disk

Does that help?
 
Old 03-17-2005, 07:58 AM   #3
cfcmark
LQ Newbie
 
Registered: Jun 2004
Posts: 5

Original Poster
Rep: Reputation: 0
Hi Oneandoneis2, thanks for you reply. Let me run what I've gleened from the web so far and I stress this is all conjecture on my part. I build a system from scratch. The server automatically locates the disk drive on the first relevant port and installs the boot partition there. After installation is complete I see:
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p3 67945696 12139224 52354996 19% /
/dev/cciss/c0d0p1 51342 14076 34615 29% /boot
none 1971924 0 1971924 0% /dev/shm

If I look at file /dev/ccis/c0d0p1 I see it has a major number of 104 and a minor number of 1. So it's using the driver code identified by 104 and using comms channel 1. The file /dev/ccis/c0d0p3 points to another partition on the same disk using 104 and 3. So if I add a new disk to this machine how does the system know it's there. Is it related to the major minor numbers? Am I barking up the wrong tree?
Mark.
 
Old 03-17-2005, 08:10 AM   #4
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
Ah. You're using a SCSI array rather than a nice simple IDE arrangement then

I'm not sure I really understand your question. If you add a new disc, it'll find it when it looks for all the hardware, the same as with any hardware. If you mean how does it assign a disc to a /dev entry, that depends what you're using - udev, devfs, etc.

Incidentally, you might find it worth exploring the /proc/driver/cciss filesystem. . .
 
Old 03-17-2005, 08:51 AM   #5
cfcmark
LQ Newbie
 
Registered: Jun 2004
Posts: 5

Original Poster
Rep: Reputation: 0
To be honest I just plugged the machine in and loaded the O/S using all the defaults from the cd's I didn't know what disks were in there. As you've probably guessed I'm not from this kind of background. I was intrigued as to how the system knows where disks are but that appears to be automatic. This all came about as I was trying to get my head around how the unix filesystem bolted together. I like to try to get a good mental picture of what's going on but rather than getting clearer, the more I looked the cloudier it became. I think I need to go work somewhere where there's a unix admin team. Thanks for your help anyway. Mark.
 
  


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
the best "unix like" or "unix" operating system melinda_sayang General 12 12-03-2004 02:50 AM
Unix Book for Beginners (Not Linux... Unix) suse2166 General 6 11-25-2004 11:46 AM
UNIX (Linux, BSD, etc) Programming :: UNIX kuphryn Programming 8 04-04-2004 11:50 PM
Why did you experienced users of Unix change to unix over Windows? Laptop2250 Linux - General 11 10-28-2003 11:51 AM
How to schedule unix script periodically from unix os level??? gopi_20us Programming 2 03-11-2002 06:45 AM

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

All times are GMT -5. The time now is 12:36 AM.

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