linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Determine boot disk device name...
@ 2010-10-24  2:58 Jon Price
  2010-10-25 18:11 ` Malahal Naineni
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jon Price @ 2010-10-24  2:58 UTC (permalink / raw)
  To: linux-lvm

[-- Attachment #1: Type: text/plain, Size: 109 bytes --]

Hi,
For starters, how can I determine the physical device name of current/active
boot disk in Linux?
Tx,
Jon

[-- Attachment #2: Type: text/html, Size: 126 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-lvm] Determine boot disk device name...
  2010-10-24  2:58 [linux-lvm] Determine boot disk device name Jon Price
@ 2010-10-25 18:11 ` Malahal Naineni
  2010-10-25 19:21   ` Alexander Skwar
  2010-10-25 19:16 ` Stephane Chazelas
  2010-10-27  5:52 ` Luca Berra
  2 siblings, 1 reply; 10+ messages in thread
From: Malahal Naineni @ 2010-10-25 18:11 UTC (permalink / raw)
  To: linux-lvm

Jon Price [jonelwoodprice@gmail.com] wrote:
>    Hi,
>    For starters, how can I determine the physical device name of
>    current/active boot disk in Linux?
>    Tx,
>    Jon

cat /proc/cmdline and go from there!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-lvm] Determine boot disk device name...
  2010-10-24  2:58 [linux-lvm] Determine boot disk device name Jon Price
  2010-10-25 18:11 ` Malahal Naineni
@ 2010-10-25 19:16 ` Stephane Chazelas
  2010-12-02  3:12   ` Stuart D. Gathman
  2010-10-27  5:52 ` Luca Berra
  2 siblings, 1 reply; 10+ messages in thread
From: Stephane Chazelas @ 2010-10-25 19:16 UTC (permalink / raw)
  To: LVM general discussion and development

On Sat, 2010-10-23 at 22:58 -0400, Jon Price wrote:
> 
> Hi,
> For starters, how can I determine the physical device name of
> current/active boot disk in Linux?
[...]

Please clarify what you mean by "physical device" and "boot disk"
especially when refered to as "current/active".

Note that Linux can start on disk-less machines. "boot"ing generally
means the process that kick-starts an operating system, so there's
nothing "current" of "active" about it, it's something that happens once
and is over by the time the system is running.

If you mean where the root filesystem reside, you can do a stat(2) on /
and look at M=major(st.st_dev) and m=minor(st.st_dev).

You can look-up M in /proc/devices.

For LVM, you'll find it's "device-mapper".

You can do a dmsetup table /dev/dm-<m> to see how that is configured.

You may find for instance that it's a mirror on two scsi drives, or that
it's a raid0 on 2 loop devices. You may then use losetup to see which
files they loop on. Then do a stat(2) again on those, and you may find
that they are on network blocks which are themselves shared by another
machine from a file shared over NFS off a 3rd machine, which is virtual
and has its backend stored in a qcow2 virtual drive itself stored on a
dm-raid and with copy-on-write on another file somewhere else, at which
point you might be able to find out about the serial number of the hard
drives they're on if that's what you're after...

-- 
Stephane

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-lvm] Determine boot disk device name...
  2010-10-25 18:11 ` Malahal Naineni
@ 2010-10-25 19:21   ` Alexander Skwar
  2010-10-25 21:28     ` Malahal Naineni
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Skwar @ 2010-10-25 19:21 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]

I also wanted to suggest this, but…

benutzer@horst:~$ cat /proc/cmdline
root=/dev/xvda1 ro

At most, you can find the root device there. But not the
device from which you booted.

Since I didn't know a good answer, I didn't write anything. But
it would be interesting to find the answer!

Best regards,
Alexander

2010/10/25 Malahal Naineni <malahal@us.ibm.com>

> Jon Price [jonelwoodprice@gmail.com] wrote:
> >    Hi,
> >    For starters, how can I determine the physical device name of
> >    current/active boot disk in Linux?
> >    Tx,
> >    Jon
>
> cat /proc/cmdline and go from there!
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>



-- 
Alexander
-- 
↯    Lifestream (Twitter, Blog, …) ↣ http://alexs77.soup.io/     ↯
↯ Chat (Jabber/Google Talk) ↣ a.skwar@gmail.com , AIM: alexws77  ↯

[-- Attachment #2: Type: text/html, Size: 1833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-lvm] Determine boot disk device name...
  2010-10-25 19:21   ` Alexander Skwar
@ 2010-10-25 21:28     ` Malahal Naineni
  2010-10-26  8:29       ` Alexander Skwar
  0 siblings, 1 reply; 10+ messages in thread
From: Malahal Naineni @ 2010-10-25 21:28 UTC (permalink / raw)
  To: linux-lvm

Alexander Skwar [alexanders.mailinglists+nospam@gmail.com] wrote:
>    I also wanted to suggest this, but…
> 
>    benutzer@horst:~$ cat /proc/cmdline
>    root=/dev/xvda1 ro

I got confused with boot and root! Thanks for correction. Usually boot
disk is mounted at /boot. Your boot disk could be same as root disk (in
this case there would not be anything mounted at /boot but just a
directory).

I don't think there is a sure way to find out your boot-loader disk in
every situation as your boot-loader disk is not needed after boot.

Thanks, Malahal.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-lvm] Determine boot disk device name...
  2010-10-25 21:28     ` Malahal Naineni
@ 2010-10-26  8:29       ` Alexander Skwar
  2010-10-26 18:41         ` Malahal Naineni
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Skwar @ 2010-10-26  8:29 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

Hi!

2010/10/25 Malahal Naineni <malahal@us.ibm.com>

> Alexander Skwar [alexanders.mailinglists+nospam@gmail.com<alexanders.mailinglists%2Bnospam@gmail.com>]
> wrote:
> >    I also wanted to suggest this, but…
> >
> >    benutzer@horst:~$ cat /proc/cmdline
> >    root=/dev/xvda1 ro
>
> I got confused with boot and root! Thanks for correction. Usually boot
> disk is mounted at /boot. Your boot disk could be same as root disk (in
> this case there would not be anything mounted at /boot but just a
> directory).
>

Well, but even the location of the /boot directory/partition doesn't
necessarily tell, from where someone booted - suppose, you've got
a boot disk /dev/sda. On /dev/sda, there's grub. Grub's setup so,
that it boots a system/kernel, which is on /dev/sdb. The system
is "self contained" on /dev/sdb.

In such a case, the system would've been booted from /dev/sda,
but there's no way to tell that, once the "/dev/sdb system" has
been started - or is there?

Cheers,
Alexander
-- 
↯    Lifestream (Twitter, Blog, …) ↣ http://alexs77.soup.io/     ↯
↯ Chat (Jabber/Google Talk) ↣ a.skwar@gmail.com , AIM: alexws77  ↯

[-- Attachment #2: Type: text/html, Size: 1764 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-lvm] Determine boot disk device name...
  2010-10-26  8:29       ` Alexander Skwar
@ 2010-10-26 18:41         ` Malahal Naineni
  2010-10-26 18:55           ` Ray Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Malahal Naineni @ 2010-10-26 18:41 UTC (permalink / raw)
  To: linux-lvm

Alexander Skwar [alexanders.mailinglists+nospam@gmail.com] wrote:
>    Hi!
>    2010/10/25 Malahal Naineni <[1]malahal@us.ibm.com>
> 
>      Alexander Skwar [[2]alexanders.mailinglists+nospam@gmail.com] wrote:
>      >    I also wanted to suggest this, but…
>      >
>      >    benutzer@horst:~$ cat /proc/cmdline
>      >    root=/dev/xvda1 ro
> 
>      I got confused with boot and root! Thanks for correction. Usually boot
>      disk is mounted at /boot. Your boot disk could be same as root disk (in
>      this case there would not be anything mounted at /boot but just a
>      directory).
> 
>    Well, but even the location of the /boot directory/partition doesn't
>    necessarily tell, from where someone booted - suppose, you've got
>    a boot disk /dev/sda. On /dev/sda, there's grub. Grub's setup so,
>    that it boots a system/kernel, which is on /dev/sdb. The system
>    is "self contained" on /dev/sdb.
> 
>    In such a case, the system would've been booted from /dev/sda,
>    but there's no way to tell that, once the "/dev/sdb system" has
>    been started - or is there?

Once loader's job is done, it is not needed and I don't think there is a
way to find out your boot disk in all __situations__ as I said before.
In fact, you can use a USB disk as your boot disk and remove it after
boot.

Thanks, Malahal.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-lvm] Determine boot disk device name...
  2010-10-26 18:41         ` Malahal Naineni
@ 2010-10-26 18:55           ` Ray Morris
  0 siblings, 0 replies; 10+ messages in thread
From: Ray Morris @ 2010-10-26 18:55 UTC (permalink / raw)
  To: LVM general discussion and development

    Lacking any better answers so far, you can:

Look for grub.conf / lilo
check each device for a valid boot block (begins with EB 48 90 on x64)
Restate the question to specify what you actually want to accomplish.

    As an example of the last option, someone might try to figure
out which disk was booted from in order see which bootloader is there,
and that information will be used to do some other task, call it "task  
C".
It may be possible to figure out which bootloader it is without knowing
which device was booted from, and it may be possible to do "task C"
without either of the previously discussed steps.
--
Ray Morris
support@bettercgi.com

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php


On 10/26/2010 01:41:39 PM, Malahal Naineni wrote:
> Alexander Skwar [alexanders.mailinglists+nospam@gmail.com] wrote:
> >    Hi!
> >    2010/10/25 Malahal Naineni <[1]malahal@us.ibm.com>
> >
> >      Alexander Skwar [[2]alexanders.mailinglists+nospam@gmail.com]  
> wrote:
> >      >    I also wanted to suggest this, but…
> >      >
> >      >    benutzer@horst:~$ cat /proc/cmdline
> >      >    root=/dev/xvda1 ro
> >
> >      I got confused with boot and root! Thanks for correction.  
> Usually boot
> >      disk is mounted at /boot. Your boot disk could be same as root  
> disk (in
> >      this case there would not be anything mounted at /boot but  
> just a
> >      directory).
> >
> >    Well, but even the location of the /boot directory/partition  
> doesn't
> >    necessarily tell, from where someone booted - suppose, you've got
> >    a boot disk /dev/sda. On /dev/sda, there's grub. Grub's setup so,
> >    that it boots a system/kernel, which is on /dev/sdb. The system
> >    is "self contained" on /dev/sdb.
> >
> >    In such a case, the system would've been booted from /dev/sda,
> >    but there's no way to tell that, once the "/dev/sdb system" has
> >    been started - or is there?
> 
> Once loader's job is done, it is not needed and I don't think there  
> is a
> way to find out your boot disk in all __situations__ as I said before.
> In fact, you can use a USB disk as your boot disk and remove it after
> boot.
> 
> Thanks, Malahal.
> 
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-lvm] Determine boot disk device name...
  2010-10-24  2:58 [linux-lvm] Determine boot disk device name Jon Price
  2010-10-25 18:11 ` Malahal Naineni
  2010-10-25 19:16 ` Stephane Chazelas
@ 2010-10-27  5:52 ` Luca Berra
  2 siblings, 0 replies; 10+ messages in thread
From: Luca Berra @ 2010-10-27  5:52 UTC (permalink / raw)
  To: linux-lvm

On Sat, Oct 23, 2010 at 10:58:03PM -0400, Jon Price wrote:
>Hi,
>For starters, how can I determine the physical device name of current/active
>boot disk in Linux?
which architecture?

with x86 it is impossible to determine from what device the current
system has booted, and it is very difficult to guess which device will
be used to boot next time, this is why grub uses a device map to
associate bios hard disks to devices, which is configured at install
time.

On different arches you could have some interface to query nvram.

L.

-- 
Luca Berra -- bluca@comedia.it
         Communication Media & Services S.r.l.
  /"\
  \ /     ASCII RIBBON CAMPAIGN
   X        AGAINST HTML MAIL
  / \

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [linux-lvm] Determine boot disk device name...
  2010-10-25 19:16 ` Stephane Chazelas
@ 2010-12-02  3:12   ` Stuart D. Gathman
  0 siblings, 0 replies; 10+ messages in thread
From: Stuart D. Gathman @ 2010-12-02  3:12 UTC (permalink / raw)
  To: LVM general discussion and development

On Mon, 25 Oct 2010, Stephane Chazelas wrote:

> > For starters, how can I determine the physical device name of
> > current/active boot disk in Linux?
> [...]
> 
> Please clarify what you mean by "physical device" and "boot disk"
> especially when refered to as "current/active".

I think he means the device that will be used at the next boot (where
"device" can be network), which is of course a BIOS question.  He may be coming
from AIX where there is a command to query and set the boot device list in the
BIOS config.

Such a utility is easy with openfirmware.  It is feasible with proprietary
firmware, but has to know about a lot of variations on CMOS layout.

-- 
	      Stuart D. Gathman <stuart@bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-12-02  3:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-24  2:58 [linux-lvm] Determine boot disk device name Jon Price
2010-10-25 18:11 ` Malahal Naineni
2010-10-25 19:21   ` Alexander Skwar
2010-10-25 21:28     ` Malahal Naineni
2010-10-26  8:29       ` Alexander Skwar
2010-10-26 18:41         ` Malahal Naineni
2010-10-26 18:55           ` Ray Morris
2010-10-25 19:16 ` Stephane Chazelas
2010-12-02  3:12   ` Stuart D. Gathman
2010-10-27  5:52 ` Luca Berra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).