home | list info | list archive | date index | thread index

Re: [Bulk] Re: [Bulk] Re: [OCLUG-Tech] Harddisk location on a virgin machine ??

  • Subject: Re: [Bulk] Re: [Bulk] Re: [OCLUG-Tech] Harddisk location on a virgin machine ??
  • From: Bart Trojanowski <bart-oclug [ at ] jukie [ dot ] net>
  • Date: Fri, 26 Oct 2007 12:36:42 -0400
* William Case <billlinux [ at ] rogers [ dot ] com> [071026 12:20]:
> fdisk calls the harddisk and partition "major" and "minor"; Grub uses
> hd0,0 or whatever.  (Not yet sure they are the same thing.) This gets
> translated by Linux when it is finally booted into /dev/sda1 or
> whatever.  I am trying to figure out at the hardware level, what is the
> first name/location of a disk as known to BIOS and how does that
> translated into major and minor; hd0,0; and then /dev/sda1?  I have the
> code for Grub that shows the final step; hd0,0 ==> sda1.

What BIOS calls disks does not get mapped into how Linux uses disks.
Linux will find out what's in the system on it's own.

To be more specific, the BIOS calls the first partition on the first
disk 0x80.

Now getting back to your naming issues.

"major/minor" refers to the device numbers that UNIX uses for numbering
devices:

# ls /dev/sda1 -l
brw-rw---- 1 root disk 8, 1 2007-10-13 10:43 /dev/sda1
                       ^  ^
                       |  |
                       |  +---- minor=1
                       +------- major=8

Grub uses hd0,0 to mean the first partition on the fist disk.  Grub uses
the BIOS drive mappings -- it would convert hd0,0 to 0x80 when issuing
BIOS service calls.

Linux will probe all PCI devices, load up drivers for those it knows,
assign a number to each controller; drivers will then give numbers to
each device on the controller (sda is the first scsi disk).  The MBR of
each block device will reveal the partitioning of that device.  Each
partition gets a device number (sda1 is the first partition the first
disk).

# ls /dev/disk/by-path -l
lrwxrwxrwx 1 root root  9 2007-10-13 10:43 pci-0000:00:07.0-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 2007-10-13 10:43 pci-0000:00:07.0-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2007-10-13 10:43 pci-0000:00:07.0-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2007-10-13 10:43 pci-0000:00:07.0-scsi-0:0:0:0-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 2007-10-13 10:43 pci-0000:00:07.0-scsi-0:0:0:0-part4 -> ../../sda4

-Bart

-- 
				WebSig: http://www.jukie.net/~bart/sig/