LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 05-04-2008, 02:48 AM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
hdd/sda: How to find which one is hd0 and hd1 ?


Hello,

I would like to find which one of my harddisk is hd0 and hd1 ?

fdisk -l gives nice stuffs but nothing about hdX


No # cat /boot/grub/device.map
works since I booted with knoppix the broken pc

Last edited by frenchn00b; 05-04-2008 at 02:51 AM.
 
Old 05-04-2008, 03:12 AM   #2
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,526

Rep: Reputation: 53
I believe all of latest kernels name all hard drives sd(x). So, hd0 would be sda and hd1 would be sdb.

Hope that helps

Bob
 
Old 05-04-2008, 03:37 AM   #3
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by BobNutfield View Post
I believe all of latest kernels name all hard drives sd(x). So, hd0 would be sda and hd1 would be sdb.

Hope that helps

Bob
Nope
it is not possible : wrong answer.
If you have ide card to plug sdaX, it is not true anymore.


Is there a code/ command line to check it ??
 
Old 05-04-2008, 03:51 AM   #4
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,526

Rep: Reputation: 53
OK, I will leave that as you wish. However, I run six distros, one machine with two SATA drives, two IDE drives and they are all identified as sd(X) with the fdisk -l command in all six distros running the 2.6 kernel. This is also true for removable pen drives when inserted. But, if you see it differently, that's OK with me.

Bob
 
Old 05-04-2008, 03:55 AM   #5
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
In Grub configuration hd0 means the primary harddisk and hd1 secondary; that naming is different on your Linux operating system itself, because there devices are (at least as of now, unless you've made your own changes) called hdXN, where X is a letter and N a number. In the past IDE disks used to be hda(primary)/hdb(secondary), but in newer operating systems the naming is "unified" a little and so even IDE disks are now called sda/sdb and so on, just like the other harddisks. USB devices are called that too, to bring up a little mixing..but I think it still works like this:

- your primary harddisk is sda
- your secondary harddisk (if any) is sdb
- your other devices are sdX, where X is some other letter

For example my harddisk is sda, it's partitions sda1-sda6, and if I plug a USB stick in, it's sdf (partition sdf1, it only has one partition). And I don't have any hdX devices.
 
Old 05-04-2008, 04:11 AM   #6
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by BobNutfield View Post
OK, I will leave that as you wish. However, I run six distros, one machine with two SATA drives, two IDE drives and they are all identified as sd(X) with the fdisk -l command in all six distros running the 2.6 kernel. This is also true for removable pen drives when inserted. But, if you see it differently, that's OK with me.

Bob
after the grub-install

hd0 hde 1
hd1 sda 2 (<- to check)
hd2 sda 1

amuzing
 
Old 05-04-2008, 04:12 AM   #7
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by b0uncer View Post
In Grub configuration hd0 means the primary harddisk and hd1 secondary; that naming is different on your Linux operating system itself, because there devices are (at least as of now, unless you've made your own changes) called hdXN, where X is a letter and N a number. In the past IDE disks used to be hda(primary)/hdb(secondary), but in newer operating systems the naming is "unified" a little and so even IDE disks are now called sda/sdb and so on, just like the other harddisks. USB devices are called that too, to bring up a little mixing..but I think it still works like this:
meaning that it is the total mess now

Thanks !!!! I keep fighting with that machine
 
Old 05-04-2008, 04:14 AM   #8
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Original Poster
Rep: Reputation: 57
Except of cat ... device.map

Cannot we ask grub to tell us what he sees for hd0, hd1, hd2, ... directly to him, Mr Grub, with a command line ? lol
 
Old 05-04-2008, 04:25 AM   #9
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Original Poster
Rep: Reputation: 57
would be great that grub could have a --list to tell us what are those disks and partitions ...
tricky


grub > list or ls disks could be a great stuffs for newbies that fight

grub-installer --root-directory isnt working so great
better by far: root (hd0,0 ) & setup (hd0)
 
Old 05-04-2008, 05:53 AM   #10
mrrangerman
Member
 
Registered: Oct 2007
Location: MI
Distribution: Debian Slackware
Posts: 528

Rep: Reputation: 59
Quote:
frenchn00b
would be great that grub could have a --list to tell us what are those disks and partitions ...
tricky


grub > list or ls disks could be a great stuffs for newbies that fight

grub-installer --root-directory isnt working so great
better by far: root (hd0,0 ) & setup (hd0)
Um what does it matter to Grub what the setup is? All Grub needs to know is where Grub is found. You can ask Grub, at bootup or from a terminal window.

At the boot menu press c then ask, the command is find /boot/grub/menu.lst and Grub will tell you what drive Grub is on.
Or you can open a terminal log in as root then type grub this will start the grub command line, then give the command find /boot/grub/menu.lst

Or you can ask Grub the partitioning scheme with the command geometry (hd0)

As for a list of all drives fdisk -l <- what linux sees

Or try dmesg

And yes I believe as of kernel-2.6.20 all devices are seen as sd- except floppy drives.

Last edited by mrrangerman; 05-04-2008 at 05:55 AM.
 
Old 05-04-2008, 06:22 AM   #11
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by mrrangerman View Post
Um what does it matter to Grub what the setup is? All Grub needs to know is where Grub is found. You can ask Grub, at bootup or from a terminal window.

At the boot menu press c then ask, the command is find /boot/grub/menu.lst and Grub will tell you what drive Grub is on.
Or you can open a terminal log in as root then type grub this will start the grub command line, then give the command find /boot/grub/menu.lst

Or you can ask Grub the partitioning scheme with the command geometry (hd0)

As for a list of all drives fdisk -l <- what linux sees

Or try dmesg

And yes I believe as of kernel-2.6.20 all devices are seen as sd- except floppy drives.
Thank you
Sounds good that [B]geometry (hd0)

Even better, with the knoppix installation, grub had the (hd0) to fd0
That's kind of amazing thing, with 3 harddrives.
 
Old 05-14-2008, 02:26 PM   #12
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
Some of my observations, for what they're worth:

Grub's (legacy 0.97) hd0, hd1, hd2 have little to do with /dev/hd0 ,1 2 etc. or, as they now are /dev/sd0, 1, 2 etc.

If you have an older machine with a Zip drive the names can change under grub. On my machine the first IDE drive is hd0, the fakeraid card is hd1, unless the zip drive is active (with a cassette in it) on the second IDE channel, in which case the zip is hd1 and the fakeraid card is hd2. Obviously a grub menu booting off anything but hd0 is affected depending on whether or not there's a zip disk in the drive. The BIOS boot order settings don't change these things.

However, everybody comes up consistently under slackware, where the first IDE is /dev/hda, the zip is /dev/hdb (regardless of whether the drive has a cassette) and the fake raid card comes up /dev/hde and /dev/hdg.

Grub's device.map file may not list the devices the same if it is run from a floppy (native installation) or from the harddisk. So you can ask grub what it thinks the geometry is, but it may change its mind.

That's why I like to manually install things...
 
  


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
How Do I Change root(hd1,0) to rootnoverify(hd1,0)? Norab Linux - Software 5 08-20-2005 02:24 PM
Dual system boot err: rootnoverify(hd1,0),but the hd0 err msg existed befor shut down lilipeng24 Linux - General 3 06-25-2005 12:10 PM
Grub cannot find the filesystem type of my hd0 drive JimmyGourd Linux - Newbie 9 09-25-2004 12:28 PM
Installing Win98SE on HD1 with LILO, XP, Mandrake+ already on HD0 Xochipilli2012 Linux - Newbie 4 06-20-2004 06:24 PM
Grub can't find files on (hd0,0) nathology Linux - Software 6 10-24-2003 10:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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