LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-06-2006, 12:27 AM   #1
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
How to determine your boot device


Is there a way to determine what device was used to boot Linux?

e.g., when I boot normally on my system with two PATA drives, I boot off of /dev/hda, on my SATA system the boot device would be /dev/sda. And if I boot Knoppix/Slax/etc CD then my boot device would be /dev/hdc on the PATA system, or /dev/hda on the SATA box.

I've been nosing around in /proc trying to locate this info but haven't run into it yet. I thought I needed this info for some automatic mounting I was trying to do on boot from a Slax CD, but I found another way to accomplish that task. It's more of an academic question now. Just wondering.
 
Old 04-06-2006, 04:57 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Unlikely I would think. Hard enough to do in the simple case as I suspect no-one cares at early boot time.

Chainloading would toss all that in the bin anyway.
 
Old 04-06-2006, 05:41 PM   #3
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
There is a simple and logical explanation to all these device names.

hda, hdb, hdc and hdd are IDE channels of primary master, primary slave, secondary master and secondary slave positions of the two IDE cables. IF you hook the CD rom to secondary master position then Knoppix will tell you the boot device is hdc.

You obviously have two IDE or PATA disks hooked to the primary IDE cable if they are called hda and hdb.

Sata is always named as sda although older distros may use hde.

Any of the above names can be pin-pointed to the exact location where the hard ware is connected to the mobo so no confusion at all. You only fool yourself but not Linux.
 
Old 04-06-2006, 07:24 PM   #4
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Original Poster
Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by saikee
hda, hdb, hdc and hdd are IDE channels of primary master, primary slave...
Thanks. I know how these things are referenced, I was attempting to write a script that would determine it for that script's own use, not my personal knowledge. I know which device I will be booted off of before I even start the boot process. But a script doesn't. My original "need" for this info was because I wanted to boot Slax and have it automatically mount the CD it booted off of, because I had other stuff on that CD (actually a DVD) besides the Slax installation. Big stuff, that wouldn't be appropriate for Slax's rootcopy scenerio. With multiple CD/DVD drives in my systems and some with SATA, some without, I wasn't sure how to identify the boot device. But this problem was solved much easier by adding the following to rc.slax:
Code:
/bin/mkdir /cdrom
/bin/mount -t iso9660 /dev/cdrom /cdrom
How stupid of me. I was looking for /dev/hda, /dev/hdb, etc. when I could just reference it as /dev/cdrom. This references the first CD in the system, which is always the one I boot from.

---

Maybe boot device isn't even determinable, like syg00 said. It's just an academic question at this point anyways.

p.s. - I was trying things like: "cd /boot; df ." which I thought kindof, mightof, couldof worked. For a harddisk boot maybe, but not when you're booting from a CD.

Thanks!
 
  


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
How to determine what device to mount for digital cam. RVDowning Mandriva 7 03-23-2006 09:39 PM
Can't determine modem as device on list Deke1955 Linux - Hardware 1 09-26-2005 12:04 PM
How to determine which disk device is on which controller? vulture99 Linux - Hardware 3 05-05-2005 10:26 PM
How to determine PTY device of ethernet card The MCP Linux - Networking 1 08-17-2004 12:36 AM
How to determine device names yian Linux - General 2 10-21-2002 07:56 PM

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

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