[NTLUG:Discuss] Bash script way to tell if a filesystem is mounted

Leroy Tennison leroy_tennison at prodigy.net
Sun May 30 21:35:35 CDT 2010


Ralph Green wrote:
> 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?
>>     
>
>
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>
>   
My system is ext3.  Just out of curiosity, what is your objection to 
ext3/ext4?  I know that ext3 is slow when searching for files and ext4 
is new (maybe still buggy).  Other things I'm missing?

Patrick, what file system is your results associated with?



More information about the Discuss mailing list