How Do You Find Logs on a Linux Server That Pertain to a Failed mount Command?

Problem scenario
You want to set up a file share through Oracle VirtualBox.  You are trying to mount a file share on a Linux guest running via Oracle VirtualBox on a Windows host.   The mount command fails and you want to find relevant logs.  What do you do?

To find logs that are appropriate to debugging a mount command that does not work, try this:

grep -e mount -e vboxsf -lR /var/log 2> /dev/null | xargs ls -lhn --sort=time

On a busy system with considerable logging, you can run the mount command once to get a baseline of results.  Then you could try the mount command that is failing.  Then wait a couple minutes.  Finally run the above "grep" command a second time.  The output of recently modified files should allow you to determine which logs are being updated by the failed mount operation.

The /var/log/auth.log file or /var/log/syslog file commonly gets updated with events related to the mount utility.  You may want to copy these files to the /tmp/ directory so you have a standalone copy.  In case these logs need to be updated while you are viewing them with vi, using a standalone copy will do no harm (and cause no corruption or prevent important logging).

For future reference
Sometimes you need to find appropriate logs for mounting a specific file system that has nothing to do with a file share for Oracle VirtualBox.  To find logs for a file system such as ext4, you would run this command:

grep -e mount -e ext4 -lR /var/log 2> /dev/null | xargs ls -lhn --sort=time

Leave a comment

Your email address will not be published. Required fields are marked *