[Tutor] Test If File System is mounted in Linux

Adam apb_4 at users.sourceforge.net
Fri Mar 17 18:41:25 CET 2006


On 17/03/06, Bill Campbell <bill at celestial.net> wrote:
> On Fri, Mar 17, 2006, Michael Lange wrote:
> >On Fri, 17 Mar 2006 00:36:35 -0700
> >fortezza-pyt <fortezza-pyt at fortezzazone.org> wrote:
> >
> >> If there a semi-standard way to test if a file system has been mounted
> >> or not using Python? In the Linux command line, I can type "mount" and
> >> see all mounted file system, and then see if the one I am looking for is
> >> in the list. While I could replicate this with
> >> Python, I am curious if there is an easier way.
> >>
> >
> >Hi Fortezza,
> >
> >try os.path.ismount() .
>
> That's fine if one knows what the mount points are.
>
> The more general problem is to get a list of mounted file systems.
>
How about just reading the mtab? That's usually /etc/mtab it should be
readable as a user and it means you don't have to rely on any other
programs.


More information about the Tutor mailing list