Hi people, and happy holidays to all of you ! Here's one from the trenches: How do I identify the device I booted off ? rdev tells me the root-patition, but that's not what I am after ? Maybe the [hs]da device always the boot device ? (which is the assumtion I work on at the moment) Any thoughts ? Regards Dan
On Thursday 23 December 2004 10:32, Dan Am wrote:
Here's one from the trenches: How do I identify the device I booted off ? rdev tells me the root-patition, but that's not what I am after ? Maybe the [hs]da device always the boot device ? (which is the assumtion I work on at the moment)
try fdisk -l marvin ~ # fdisk -l Disk /dev/sda: 73.5 GB, 73557090304 bytes 255 heads, 63 sectors/track, 8942 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 20 160618+ 83 Linux /dev/sda2 21 1065 8393962+ 83 Linux /dev/sda3 1066 2110 8393962+ 83 Linux . . There you see that it is /dev/sda1 that is marked as bootable. regards Jonas -- Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway. -Andrew S. Tanenbaum. Computer Networks.
Hi, Am Donnerstag, 23. Dezember 2004 10:48 schrieb Jonas Helgi Palsson:
There you see that it is /dev/sda1 that is marked as bootable. ...but then, that is not a surefire way, since there might be none (my system) or more than one (eg. in case of raid boot) marked boot"able" . I can think of some educated guesses, and yours is not too bad, but does the system not know where it came from ? Thinking about it, maybe it _can't_ know that, only if the bootloader passed something to the kernel. Hmmmmm....is my logic right here ?
Regards Dan
On Thu, 23 Dec 2004 11:21:48 +0100, Dan Am
Hi, Am Donnerstag, 23. Dezember 2004 10:48 schrieb Jonas Helgi Palsson:
There you see that it is /dev/sda1 that is marked as bootable. ...but then, that is not a surefire way, since there might be none (my system) or more than one (eg. in case of raid boot) marked boot"able" . I can think of some educated guesses, and yours is not too bad, but does the system not know where it came from ? Thinking about it, maybe it _can't_ know that, only if the bootloader passed something to the kernel. Hmmmmm....is my logic right here ?
Regards Dan
The kernel definately knows what you are booting off of. My proof is that if you dd copy a /dev/sda to /dev/hda, then remove /dev/sda and try to boot from /dev/hda?, the kernel will be launched, but booting fails as soon as the kernel tries to access /dev/sda?. The fix to that problem is to use the kernel parameter "root=/dev/hda?" to tell is were it is booting from. I have had to do this via the grub boot editor in the past. I don't know how to access that info, but it definately exists. Greg -- Greg Freemyer
On Thursday 23 December 2004 10:21 am, Dan Am wrote:
Hi,
Am Donnerstag, 23. Dezember 2004 10:48 schrieb Jonas Helgi Palsson:
There you see that it is /dev/sda1 that is marked as bootable.
...but then, that is not a surefire way, since there might be none (my system) or more than one (eg. in case of raid boot) marked boot"able" . I can think of some educated guesses, and yours is not too bad, but does the system not know where it came from ? Thinking about it, maybe it _can't_ know that, only if the bootloader passed something to the kernel. Hmmmmm....is my logic right here ?
Regards Dan
Yes, I think you are on the right lines here. Imagine a system, not quite unlike mine, with 3 primary partitions: /dev/ sda1,2,3. Each of these is bootable and has GRUB installed, and each GRUB uses a menu on its own partition. Suppose that each GRUB menu has an entry pointing to a single kernel in /boot on a 4th partition, /dev/sda4, which is also mounted as the root partition. Whichever you booted, there would be no fundamental difference, except possibly for some traces in the memory used by the BIOS. I think the 'active partition' as used by the boot process will be marked by the '*', as pointed out by Jonas. But if you use the partitioner to change the active partition, that could change [not sure]. This is the point where I ask 'why do you want to know?', in the hope of finding a more answerable question. rgds Vince
On a couple of my machines the answer is:
cat /proc/cmdline
It shows "root=/dev/hda3" etc. as part of the boot args.
PS: Thanks to Felix Miata for asking about /proc/cmdline or I would
not have known about its existence.
Greg
--
Greg Freemyer
On Thu, 23 Dec 2004 19:18:03 +0000, Vince Littler
On Thursday 23 December 2004 10:21 am, Dan Am wrote:
Hi,
Am Donnerstag, 23. Dezember 2004 10:48 schrieb Jonas Helgi Palsson:
There you see that it is /dev/sda1 that is marked as bootable.
...but then, that is not a surefire way, since there might be none (my system) or more than one (eg. in case of raid boot) marked boot"able" . I can think of some educated guesses, and yours is not too bad, but does the system not know where it came from ? Thinking about it, maybe it _can't_ know that, only if the bootloader passed something to the kernel. Hmmmmm....is my logic right here ?
Regards Dan
Yes, I think you are on the right lines here.
Imagine a system, not quite unlike mine, with 3 primary partitions: /dev/ sda1,2,3. Each of these is bootable and has GRUB installed, and each GRUB uses a menu on its own partition. Suppose that each GRUB menu has an entry pointing to a single kernel in /boot on a 4th partition, /dev/sda4, which is also mounted as the root partition.
Whichever you booted, there would be no fundamental difference, except possibly for some traces in the memory used by the BIOS. I think the 'active partition' as used by the boot process will be marked by the '*', as pointed out by Jonas. But if you use the partitioner to change the active partition, that could change [not sure].
This is the point where I ask 'why do you want to know?', in the hope of finding a more answerable question.
rgds
Vince
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
Greg Freemyer wrote:
On a couple of my machines the answer is:
cat /proc/cmdline
It shows "root=/dev/hda3" etc. as part of the boot args.
PS: Thanks to Felix Miata for asking about /proc/cmdline or I would not have known about its existence.
I considered submitting /proc/cmdline as an answer to the question, but rejected it. You can look at /etc/mtab to see what partition is mounted as /. But, that may or may not have anything to do with what partition was booted from. My systems boot using grub from a partition separate from /. That's where the kernel lives prior to loading. That's where OS boot starts. / is all supporting cast. -- "I am the way, and the truth, and the life. No one comes to the Father except through me." John 14:6 NIV Team OS/2 ** Reg. Linux User #211409 Felix Miata *** http://members.ij.net/mrmazda/partitioningindex.html
On Thu, 23 Dec 2004 16:24:07 -0500, Felix Miata
Greg Freemyer wrote:
On a couple of my machines the answer is:
cat /proc/cmdline
It shows "root=/dev/hda3" etc. as part of the boot args.
PS: Thanks to Felix Miata for asking about /proc/cmdline or I would not have known about its existence.
I considered submitting /proc/cmdline as an answer to the question, but rejected it. You can look at /etc/mtab to see what partition is mounted as /. But, that may or may not have anything to do with what partition was booted from. My systems boot using grub from a partition separate from /. That's where the kernel lives prior to loading. That's where OS boot starts. / is all supporting cast. -- "I am the way, and the truth, and the life. No one comes to the Father except through me." John 14:6 NIV
Team OS/2 ** Reg. Linux User #211409
Felix Miata *** http://members.ij.net/mrmazda/partitioningindex.html
So, you take the question to be: "Where was the kernel/initrd read from during bootup?" I don't think that can be determined. Equally unknown would be: "Which disks MBR was used during boot?" "Which disk/partition was grub loaded from?" Anything related to Stage 1, 1.5, 2 of grub. All the above are grub specific issues, not linux. Linux is not running until grub has completed loading the kernel and initrd into RAM. Greg
On Thursday 23 December 2004 8:44 pm, Greg Freemyer wrote:
On a couple of my machines the answer is:
cat /proc/cmdline
It shows "root=/dev/hda3" etc. as part of the boot args.
PS: Thanks to Felix Miata for asking about /proc/cmdline or I would not have known about its existence.
Greg -- Greg Freemyer
On Thu, 23 Dec 2004 19:18:03 +0000, Vince Littler
<****@***********.*******.**.**> wrote:
On Thursday 23 December 2004 10:21 am, Dan Am wrote:
Imagine a system, not quite unlike mine, with 3 primary partitions: /dev/ sda1,2,3. Each of these is bootable and has GRUB installed, and each GRUB uses a menu on its own partition. Suppose that each GRUB menu has an entry pointing to a single kernel in /boot on a 4th partition, /dev/sda4, which is also mounted as the root partition.
Whichever you booted, there would be no fundamental difference, except possibly for some traces in the memory used by the BIOS. I think the 'active partition' as used by the boot process will be marked by the '*', as pointed out by Jonas. But if you use the partitioner to change the active partition, that could change [not sure].
This is the point where I ask 'why do you want to know?', in the hope of finding a more answerable question.
rgds
Vince
Greg, I have left my original reply in place. There is a distinction between "the device I booted off", which I think Dan Am wants to know and the device which is specified as root to the kernel at boot time. In my case, I boot from GRUB on the MBR [I think], have /dev/sda1 as the active partition, pick up the kernel from /dev/sda5 and use /dev/sdb9 as the root partition. So which partition would Dan Am want? rgds Vince One final point, and sorry to sound crusty. I would be really grateful if people would NOT include my [or anyone's] email address in plain text in messages to the list, as it increases the exposure to spam via the archive. This often occurs as it did in this message in an autogenerated reply header as in:
On Thu, 23 Dec 2004 19:18:03 +0000, Vince Littler <****@***********.*******.**.**> wrote:
I have documented this on the OT list. This header should be configurable in any client, and if it is not, then I think there is a straight choice between conscientously editing the autogenerated text, or choosing a configureable client.
On Thursday 23 December 2004 5:19 pm, Greg Freemyer wrote:
"Where was the kernel/initrd read from during bootup?"
I don't think that can be determined.
Equally unknown would be:
"Which disks MBR was used during boot?"
"Which disk/partition was grub loaded from?"
Anything related to Stage 1, 1.5, 2 of grub.
I have 2 HDs and boot differently depending on which one is active. if HDA is active, I boot from Grub and get the options of Windows XP and SUSE9.2, even though SUSE is on /dev/hdb10. if HDB is active I get the Xandros boot loader, also Grub I think ? and it gives me the option of XP, SUSE and Xandros ( which boots from hdb1). I really don't understand it all! -- Paul Cartwright Registered Linux user # 367800 X-Request-PGP: http://home.comcast.net/~p.cartwright/wsb/key.asc
Well guys, I have 3 harddisc drives with SuSE 8.2 on hda5 (boot), hda6 (swap) and hda7 (root) installed and I have hda1 (WinME) and Win2000 (hda2). Then I have SuSE 9.1 on hdc5 (boot), hdc6 (swap) and hdc7 (root) and I have hda1 (WinME, another one, which I can't boot right now, but shouldn't be a problem as soon as I correctly set up the grub menu.lst) Finally there is SuSE 9.2 on hdh5 (boot), hdh6 (swap) and hdh7 (root) and a Win Partition (not bootable) But how is it started? Well I choose it at the grub bootloader menu and then it is coded in initrd or the configuration of it (I think). I guess that's it. Yours Martin Paul Cartwright wrote:
On Thursday 23 December 2004 5:19 pm, Greg Freemyer wrote:
"Where was the kernel/initrd read from during bootup?"
I don't think that can be determined.
Equally unknown would be:
"Which disks MBR was used during boot?"
"Which disk/partition was grub loaded from?"
Anything related to Stage 1, 1.5, 2 of grub.
I have 2 HDs and boot differently depending on which one is active. if HDA is active, I boot from Grub and get the options of Windows XP and SUSE9.2, even though SUSE is on /dev/hdb10. if HDB is active I get the Xandros boot loader, also Grub I think ? and it gives me the option of XP, SUSE and Xandros ( which boots from hdb1). I really don't understand it all!
On Thursday 23 December 2004 6:54 pm, Martin Deppe wrote:
I have 3 harddisc drives with SuSE 8.2 on hda5 (boot), hda6 (swap) and hda7 (root) installed and I have hda1 (WinME) and Win2000 (hda2).
WinME ??? YUCK ! the worst of M$ !
Then I have SuSE 9.1 on hdc5 (boot), hdc6 (swap) and hdc7 (root) and I have hda1 (WinME, another one, which I can't boot right now, but shouldn't be a problem as soon as I correctly set up the grub menu.lst)
Finally there is SuSE 9.2 on hdh5 (boot), hdh6 (swap) and hdh7 (root) and a Win Partition (not bootable)
so why both 9.1 and 9.2 ? or are you just testing 9.2 ?
But how is it started? Well I choose it at the grub bootloader menu and then it is coded in initrd or the configuration of it (I think).
at least you have it written down....
I guess that's it. until it fails.. -- Paul Cartwright Registered Linux user # 367800 X-Request-PGP: http://home.comcast.net/~p.cartwright/wsb/key.asc
Dan Am wrote:
Hi people,
and happy holidays to all of you ! Here's one from the trenches: How do I identify the device I booted off ? rdev tells me the root-patition, but that's not what I am after ? Maybe the [hs]da device always the boot device ? (which is the assumtion I work on at the moment)
Why not use the boot loader, to set an environment variable?
Paul Cartwright wrote:
On Thursday 23 December 2004 6:54 pm, Martin Deppe wrote:
I have 3 harddisc drives with SuSE 8.2 on hda5 (boot), hda6 (swap) and hda7 (root) installed and I have hda1 (WinME) and Win2000 (hda2).
WinME ??? YUCK ! the worst of M$ !
For my games it runs well enough so far ( unfortunately they do not run under linux)
Then I have SuSE 9.1 on hdc5 (boot), hdc6 (swap) and hdc7 (root) and I have hda1 (WinME, another one, which I can't boot right now, but shouldn't be a problem as soon as I correctly set up the grub menu.lst)
Finally there is SuSE 9.2 on hdh5 (boot), hdh6 (swap) and hdh7 (root) and a Win Partition (not bootable)
so why both 9.1 and 9.2 ? or are you just testing 9.2 ?
Well, I had 9.1 running very well before I got I simply didn't remove it yet and until I had 9.2 setup the same level which I have now (mostly)
But how is it started? Well I choose it at the grub bootloader menu and then it is coded in initrd or the configuration of it (I think).
at least you have it written down....
Sorry, if bother you!
I guess that's it.
until it fails..
What do you mean? :-D Martin
participants (8)
-
Dan Am
-
Felix Miata
-
Greg Freemyer
-
James Knott
-
Jonas Helgi Palsson
-
Martin Deppe
-
Paul Cartwright
-
Vince Littler