On 04/12/12 08:18, 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. > > I can quickly and easily do a 'blkid' and get a list of block devices > attached and I can identify the actual drives (major number 8) and I can do > the usual check for "/", etc. but I keep feeling that I'm missing some not so > fringe cases where the boot/root volume may not be screamingly obvious. > > I am wondering if there's some "proper" tool/utility that I can ask directly > and have the system return the authoritative answer. Of course, finding it in > /proc is reasonable since it's much more likely to be an authoritative answer. > > Anyone have any advice or thoughts? > > Thanks in advance for any help offered. >
Could you iterate through the available block devices, mounting each and checking for the directories that LSB requires? Minimally, I think this would be /usr, /bin, /etc, and /lib. /etc and /usr should be enough to differentiate it from other filesystems that also contain bin and lib directories. Skylar _______________________________________________ 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/
