Nautilus browsing large windows share is slow

When browsing large windows (samba) shares with Ubuntu Nautilus (that’s the equivalent of the Windows File Explorer) I observed that shares which include many files and directories (a few hundred) take a few seconds to browse over WiFi, but almost instantly display over a fast LAN. A similar difference in speed is noticeable when searching for files with Nautilus.

Interestingly this doesn’t seem to be the case with sshfs mounts or when mounting a remote share as a local mount with cifs or browsing with smb-client.

The solution is to create a mount point in /media, eg. /media/Photos and mount it in /etc/fstab

//fileserver/Photos /media/Photos cifs vers=3.0,guest,soft,nofail,noauto,x-systemd.automount,x-systemd.device-timeout=5s,iocharset=utf8,cache=loose,fsc,users 0 0

cifs-specific mount options are described here: https://linux.die.net/man/8/mount.cifs and general fstab options are described here: https://wiki.archlinux.org/index.php/fstab

Some options explained:

Directly specifying the protocol version with “vers” reduces negotiation time (I hope, haven’t tried). The “guest” option mounts the share without user credentials (that’s ok in my case, you might want to provide user credentials instead). The “soft” option makes sure that access to the shares time out when the share is not available instead of hanging indefinitely. “noauto,x-systemd.automount” postpones mounting until the share is accessed. “nofail” makes sure the boot process doesn’t fail if the mount fails (useful since it is a network share and the server or network might be down). “x-systemd.device-timeout” reduces the wait time to 5 seconds in case the mount fails due to network issues. “iocharset” enables non-latin characters in file names. “cache” and “fsc” enable aggressive caching (you might want to skip those in a shared access environment). “users” is a weird one: Nautilus fails mounting with a note about the user not being “root” if that option is missing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.