autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to query filesystem type?


From: Rob Latham
Subject: Re: how to query filesystem type?
Date: Tue, 5 Jul 2011 11:11:12 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Jul 05, 2011 at 09:41:37AM -0600, Jim Edwards wrote:
> I would like to have autoconf determine if a target filesystem is gpfs or
> lustre - are there existing tools to do this?
> 
> If not is anyone aware of a shell command that would provide this?

i'd just like to point out that in general there's no guarantee that
the file system you detect at configure time will be the one you
access during run time. 

the 'stat -f /path/to/file_system' command can give you the
information you want:

% stat -c %T -f /
ext2/ext3

If you use the system call statfs(2) you can determine the fs type at runtime.  
Nowadays it's even reasonably (but not entirely) portable:

struct statfs has a f_fsid member.  The magic number for Lustre is "#define
LL_SUPER_MAGIC 0x0BD00BD0" (defined in lustre_user.h).  The magic number for
GPFS is ...  0x47504653 I guess?   

On Darwin, the f_fsid is a short, so these magic numbers might get truncated.

==rob

-- 
Rob Latham
Mathematics and Computer Science Division
Argonne National Lab, IL USA



reply via email to

[Prev in Thread] Current Thread [Next in Thread]