There's a contradiction between On 2017-10-18 15:01:23 +0200, Martijn Dekker wrote: > GNU stat (or gstat) makes this trivial: 'stat --file-system --format=%i > /file/one /file/two' provides two hexadecimal file system identifiers to > compare. But GNU stat is not standard and nowhere near ubiquitous. BSD > 'stat' does not have any such feature.
and On 2017-10-21 02:39:42 +0200, Martijn Dekker wrote: > Hmm... on Linux, there can be several tmpfs mounts and they all have the > same file system name in the first column. Example: > > tmpfs 33039212 0 33039212 0% /dev/shm > tmpfs 33039212 3277180 29762032 10% /run > tmpfs 5120 0 5120 0% /run/lock > tmpfs 33039212 0 33039212 0% /sys/fs/cgroup > > Looks like we also need the mount point to uniquely identify a file > system. A little tweak to the sed incantation accomplishes that: > > df -P /dev/shm /run | > sed '1d; > s/\([[:blank:]]\{1,\}[[:digit:]]\{1,\}\)\{4\}%[[:blank:]]\{1,\}/,/' > > gives > > tmpfs,/dev/shm > tmpfs,/run as with "stat --file-system --format=%i", the output is 0 for any file on a tmpfs. The initial question was actually not clear. First, you should define what a file system is. If this is not what is identified by st_dev[*], what is it? [*] which you can get with GNU stat, or by including a small C program in the script and compiling it. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)