2

How can I see what file system mount is using when I use the "-t auto" flag?

I am using a minimal build of Yocto Linux so I cannot simply use "file" to see what it is after the fact.

  • Do you have the usual df command? The -T option includes a column for filesystem type. If not, you'll want to extract it from /proc/mounts. – Toby Speight Jun 29 '17 at 16:32
  • My version of BusyBox only gives Pkmh for df, no -T option – ClydeTheGhost Jun 29 '17 at 16:48
3

The filesystem type is the third column in /proc/mounts; to extract that column, you can write:

awk '{print $3}' /proc/mounts

To make it more specific, you need to match the second column with your mountpoint:

awk "\$2 == \"$mountpoint\" {print \$3}" /proc/mounts
0

man mount gives a verbose description of that case:

If no -t option is given, or if the auto type is specified, mount will try to guess the desired type. Mount uses the blkid library for guessing the filesystem type; if that does not turn up anything that looks familiar, mount will try to read the file /etc/filesystems, or, if that does not exist, /proc/filesystems. All of the filesystem types listed there will be tried, except for those that are labeled "nodev" (e.g., devpts, proc and nfs). If /etc/filesystems ends in a line with a single *, mount will read /proc/filesystems afterwards. While trying, all filesystem types will be mounted with the mount option silent.

  • My question was more directed at, once it finds a filesystem that works (i.e. it guesses correctly), is there a command to show which one it picked? – ClydeTheGhost Jun 29 '17 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.