Re: how to query filesystem type?

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


[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
information.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf

[GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [USB]     [Samba]

Add to Google Powered by Linux