[NTLUG:Discuss] Bash script way to tell if a filesystem is mounted
Ralph Green
sfreader at sbcglobal.net
Sun May 30 01:58:58 CDT 2010
Howdy,
I thought I had the script all working and then I ran across something
like what you found. When I run the stat command on a system with jfs,
I always get a value of 0. On xfs and ext2, everything works. I don't
have any systems with ext3. Can anyone verify if a stat like Leroy used
returns a non-zero value on ext3? I would not ever setup a system with
ext3 or ext4, but I know I should be prepared if I come across one and
need to do diagnostics.
I am going to redo my script to use Chris' idea of grepping /etc/mtab
or /proc/mounts.
Good night,
Ralph
On Sat, 2010-05-29 at 16:24 -0500, Leroy Tennison wrote:
> [root at localhost ~]# stat -f --format='%i' /boot
> 0
> [root at localhost ~]# stat -f --format='%i' /boot/grub
> 0
> [root at localhost ~]#
>
> Not only am I seeing a directory and it's parent with the same file
> system ID when it is a mount point, both IDs are zero. Just in case
> Any idea what's wrong?
More information about the Discuss
mailing list