gettings mounted file systems [newbie]

Bill Anderson anderson at boi.hp.com
Wed Jan 17 09:10:18 EST 2001


Andreas Jung wrote:
> 
> On Wed, Jan 17, 2001 at 06:14:13PM +0200, Moshe Zadka wrote:
> > On Wed, 17 Jan 2001, Langa Kentane <LangaK at discoveryhealth.co.za> wrote:
> > > Greetings gurus.
> > >
> > > I am trying to find a way how I can get a list of mounted file systems using
> > > python.
> > > How would I go about doing this? I have looked into the documentation and
> > > have not found anything to help.
> 
> I think there  is no portable way. Either check /etc/mtab or under Linux /proc/mounts.
> 
> Andreas


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.

So, completely portable, No, Generally portable, (as in not requiring
say, /etc/mtab or friends), yes. (heh, note the randomly generated daily
.sig below ...)

-- 
Bill Anderson               Linux Specialist
Modular Network Storage     R&D           
Random Quote:
    Portable: survives system reboot.



More information about the Python-list mailing list