LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-05-2002, 07:18 PM   #1
Sam Hobbs
Member
 
Registered: Mar 2002
Location: Southern California
Distribution: Damn Small Linux (DSL) for now
Posts: 27

Rep: Reputation: 15
Question Logical drive numbers for disk devices


Can someone help me find the documentation of the algorithm used to assign logical drive numbers for disk devices? When I say "drive numbers" I mean the "#" in /dev/hda#.


If someone wants to correct my terminology feel free; I am not sure what is correct for Unix/Linux.

I betcha if I don't say that it is not sequential someone will say I don't need documentation that it is just sequential from the first partition to the last on the physical drive. I know that hard drive partitions can be primary, extended and logical partitions or something like that. I did know all about them a few years ago but I need to refresh my memory. I can do that but the important thing is that it appears to me that linux does not assign the numbers strictly sequentially.

The reason I am asking is because I want to know how to relate Unix/Linux drive designations to Windows drive letters. The Unix algorithm is simpler since a drive's designation is independent of the other drives but I can figure out the Windows algorithm.
 
Old 04-07-2002, 04:41 AM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232

In Linux first hd is hda, second hdb and so on. Primary partitions are hda1, hda2,..., extended start from hda5. Partintions are numbered as they are created, so it may happen that hda7 will be before hda5.
 
Old 04-07-2002, 12:36 PM   #3
Sam Hobbs
Member
 
Registered: Mar 2002
Location: Southern California
Distribution: Damn Small Linux (DSL) for now
Posts: 27

Original Poster
Rep: Reputation: 15
Do you know where that is documented?

Do you know how it is determined when a partition is "created"? I do not recall a creation date for partitions. I think the volume serial number is a date but that is relatively new and the Unix drivers that determine drive numbers is older than volume serial numbers.

What you are saying about primary partitions being numbered 1 to 4 and extended partitions being numbered starting from 5 is interesting. You are probably correct about that and that probably helps a lot. I would like to find the documentation though to ensure I have all the important details.

Perhaps instead of writing a Windows program first I should write a Linux program to show partitions and their logical drive numbers. Then I would be more likely to get people to test it and check it's accuracy. I suppose I would need the documentation of the relevant device drivers, and that is a likely place for finding the documentation I am asking about. So I should find the documentation of the disk device drivers.
 
Old 04-07-2002, 01:46 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Visit www.linuxdoc.org. What will be interesting for you is: "Kernel 2.4 Internals", "The Linux Kernel" and "Linux Programmer's Guide". Also other files, of course.
From www.kernel.org you can take Linux kernel. It may be interesting to read it's documentation, which is included.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount points on usb devices (dig. camera, zip drive, external hard disk) Impaler Linux - Hardware 3 05-29-2006 11:08 PM
io Stress on logical drive kaganis Linux - General 1 08-09-2005 10:11 PM
cloning disk using cp - no special devices for target disk vulture99 Linux - General 6 05-08-2005 05:36 PM
bogus logical disk sectors...oh my doralsoral Linux - Software 1 02-28-2004 07:30 AM
Join two HardDisks -> One logical disk PhongDN Linux - Hardware 1 01-06-2003 10:02 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:53 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