[Top][All Lists]

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

Re: how to query filesystem type?

From: Eric Blake
Subject: Re: how to query filesystem type?
Date: Tue, 05 Jul 2011 11:37:06 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

[adding coreutils]

On 07/05/2011 10:28 AM, Jim Edwards wrote:
>> the 'stat -f /path/to/file_system' command can give you the
>> information you want:
>> % stat -c %T -f /
>> ext2/ext3
> Running this on /tmp/work/$USER on jaguarpf gives
> UNKNOWN (0xbd00bd0)

Which version of coreutils?  Is this still happening in the latest
coreutils.git (in which case, this is a sign that coreutils needs to be
taught a new magic number)?

>> 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?
> I get this result from a bluegene linux front end, but not from AIX.

Disk type magic numbers are non-portable.  The magic numbers used in
Linux are not necessarily the same as exposed elsewhere.  I'm not even
sure if it is possible to make AIX output what file system type a
particular directory is, and even if it is possible, whether anyone has
yet contributed code to coreutils to make stat(1) output that information.

The problem here is that POSIX does not standardize a way to query this
type of information, so there is no portable interface to get at the

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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