gettings mounted file systems [newbie]

Pat Knight nospam at ktgroup.co.uk
Thu Jan 18 06:36:27 EST 2001


Bill Anderson <anderson at boi.hp.com> writes:
> How about parsing the mount command? I believe most mount
> implementations under various unices and variants will report what is
> mounted where. As to each of them possibly (probably) reporting
> different information along with it (and/or in a different format), you
> could handle that by testing fo ros type just prior, and calling the
> appropriately coded test.

In the way of these things, I needed to find the mount points in one of our
apps the other day. Here's the extracted code with some documentation. I
decided to parse /etc/mtab (on Linux) and /etc/mnttab (on Solaris and HP-UX)
as the file formats were more common than the output of the mount command.
Also, the mount command generates extra cruft for the benefit of human readers.

If any of you finds the attached code useful, feel free...

Cheers,
        Pat
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mounts.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20010118/2a325116/attachment.ksh>


More information about the Python-list mailing list