Some of this will depend on the reason you want this info.
I've got several systems where the device path that shows up on the
running system is not the same device path that shows up during the
installation process (and a couple where it doesn't match what's
configured in LILO or GRUB)
David Lang
On Thu, 12 Apr 2012, Justin Ellison wrote:
Using /proc/mounts is a little better for machine readability rather than
parsing the output of 'mount'.
The only way I can think of to identify the actual root device (from the
kernel perspective) is by interrogating the kernel command line. You can
find that in /proc/cmdline.
Identifying the boot device is trickier, because AFAIK, the only part of
the system that knows that information is the boot loader. For that, you
may have to parse grub.conf or lilo's config file (memory fails me on where
that is).
Hope that helps,
Justin
On Thu, Apr 12, 2012 at 11:07 AM, Miles Fidelman <[email protected]
wrote:
Michael C Tiernan wrote:
I am working on a small project and I have the need to identify the root
volume on a running linux system from inside a script. For the moment I'm
in the Red Hat EL environment but I'm expecting it to develop into a wider
application.
if you want to "problematically" identify the root volume, you might start
with a random number generator :-)
on the other hand, if you want to "programatically" (who didn't have
coffee this morning? :-) identify root, how about starting with:
mount | grep ' / '
or maybe:
mount | grep '[ \t]/[ \t]' ;in case your version of mount inserts tabs
rather than spaces as separators
then maybe pipe through sed to eliminate unwanted extraneous text
Miles Fidelman
--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
______________________________**_________________
Tech mailing list
[email protected]
https://lists.lopsa.org/cgi-**bin/mailman/listinfo/tech<https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech>
This list provided by the League of Professional System Administrators
http://lopsa.org/
_______________________________________________
Tech mailing list
[email protected]
https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
http://lopsa.org/
_______________________________________________
Tech mailing list
[email protected]
https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
http://lopsa.org/