Get the file system type where the file is stored.
1 answer
On the command line / script, you can use stat
:
$ stat -f -c "%T" someFileOnExt2Ext3
ext2/ext3
$ stat -f -c "%T" someFileOnNFS
nfs
This will eventually lead to the statfs (2) system call :
int statfs(const char *path, struct statfs *buf);
Statfs () returns information about the mounted filesystem. path is the path to any file on the mounted filesystem, buf is a pointer to a statfs structure.
+10
source to share