1

man mount:

silent Turn on the silent flag.

Who can tell me more about silent for mount ?

Or who can provide a specific code example to show this difference(silent vs loud flag)?

I simple tested no find any difference.

Thanks.

  • 1
    On what Unix is this? – Kusalananda May 22 '17 at 8:59
  • @Kusalananda this is on debian jessie – illiterate May 22 '17 at 9:10
2

If a utility has a silent or quiet option, it usually means that the utility will operate without emitting any output.

Sometimes it additionally means that the utility will not output any diagnostic messages (warnings or errors). It may also (but seldom) mean that the utility will always exit with a zero exit status and therefore always act as if the operation that it performed succeeded.

In the case of mount (on Debian at least), I'm assuming it means that mount will not cause an error message or warning if you try to mount a filesystem with, e.g., the wrong filesystem type.

The documentation of the -t option to mount on Debian has the following information:

If no -t option is given, or if the auto type is specified, mount will try to guess the desired type. [...] 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.

This is obviously a case where, if the silent option was not applied automatically, there may be a lot of unwanted output.

  • Thanks. your answer are very reasonable and helpful me understand this man mount,but can provide a specific code example to show difference("silent" vs "loud")?I simple tested no find any difference. – illiterate May 22 '17 at 9:55
  • @illiterate Sorry, I do not have access to a Debian system where I may mount things, so I can not give you a good example of the different scenarios. – Kusalananda May 22 '17 at 9:57
  • Then what is your using Unix or Unix-like system? Maybe I can test it for this question. – illiterate May 22 '17 at 10:12
  • 1
    @illiterate I'm using OpenBSD. mount on OpenBSD does not have a silent mount option. – Kusalananda May 22 '17 at 10:17
1

Normally a failed kernel mount() call will print diagnostic errors to the kernel message log that can provide more details about why it failed than just the error code returned. The MS_SILENT mount option, which mount passes to the kernel, suppresses such kernel log output. It is generally used by scripts that are trying various mount options to probe for any filesystem that can be mounted, where such log output is not likely to be helpful to the administrator.

  • Thank you. another reasonable answer, but can provide a code example to show difference between mount -o loud and mount -o silent?I tried simple test no find difference in output of dmesg(as you said kernel message log?) – illiterate May 23 '17 at 13:25
  • @illiterate, did the mount succeed? The difference is when the mount fails -- the kernel prints messages giving clues about the nature of the failure. The MS_SILENT mount flag has skip those error messages and just fail the call. – psusi May 23 '17 at 23:35
  • mount -t noext4 ./1 ./test1 -o loud vs mount -t noext4 ./1 ./test1 -o silent,As far as I saw output of dmesg,I can't found a difference.mount is failed as exit code:32, ./1 is a ext4 image file. – illiterate May 24 '17 at 8:28
  • @illiterate, there is no such filesystem. You need to use a valid filesystem to try to mount, and an image that does not contain such a filesystem. – psusi May 25 '17 at 1:09

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.