[linux-lvm] Determine boot disk device name...
stephane.chazelas at googlemail.com
Mon Oct 25 19:16:49 UTC 2010
On Sat, 2010-10-23 at 22:58 -0400, Jon Price 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".
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...
More information about the linux-lvm