[Tutor] Test If File System is mounted in Linux

Bill Campbell bill at celestial.net
Fri Mar 17 19:22:18 CET 2006

On Fri, Mar 17, 2006, Pawel Kraszewski wrote:
>Dnia piÄ
tek, 17 marca 2006 18:41, Adam napisał:
>> > 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.
>Or always-up-to-date & user readable '/proc/mounts' ?

If you're sure it's a Linux system, fine.  Like /etc/mtab, this isn't
portable.  Looking at some of the systems we have here:

Linux -- systems from Caldera OpenLinux 2.3 through SuSE 10.0,
have /proc/mounts and /etc/mtab.

FreeBSD 4.8 Stable -- has /proc file system, but no /proc/mounts,
and no /etc/mtab (yeah 4.8 is out of date, but it's been up 632
days and I want to see how long it will stay up :-).

OS X 10.4.5 (Tiger) -- no /proc/mounts or /etc/fstab

SCO OpenServer 5.0.6a -- no /proc/mounts or /etc/fstab

All of these systems have the gnu gdf which returns information
in the same format.

INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Systems, Inc.
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``Fix reason firmly in her seat and call to her tribunal every fact,
every opinion. Question with boldness even the existence of a God;
because, if there is one, he must more approve of the homage of 
reason, than that of blindfolded fear.''  --Thomas Jefferson

More information about the Tutor mailing list