Accoding to a forum the problem is with gvfs and cifs works much better. I am not familiar with these terms, but I can confirm that. By mounting the drive manually:
mount -t cifs -o username=root,password=xxxxx //192.168.0.186/asmedia-hdd /media/asmedia-hdd
I can achieve 10MB/s in Nautilus. The only problem that I don't have network discovery and I cannot umount the drive from nautilus. So I think this is not a real solution.
Is there anyway to force the Nautilus to use cifs instead of gvfs?
next
I found a config file, which appears to be very relevant:
/usr/share/gvfs/mounts/smb.mount
[Mount]
Type=smb-share
Exec=/usr/libexec/gvfsd-smb
AutoMount=false
Scheme=smb
I guess gvfs is not a partition type, it is something that uses cifs too. So I guess I can somehow set the cifs buffer size here. I was not able to find out yet how to do that.
According to wiki the gvfs is a virtual filesystem, so it can be on top of cifs, so I was right.
next
I found this answer: https://unix.stackexchange.com/a/44318/126217 by trying to gvfs mount from terminal. According to it, the export $(dbus-launch)
is important before using any gvfs command. I confirm that, I was not able to use gvfs commands from terminal, and I got only vague error messages about the problem.
I was able to mount the drive manually with gvfs:
gvfs-mount smb://WORKGROUP\;root@192.168.0.186/asmedia-hdd
I was able to list the mounted drives
gvfs-mount -l
Drive(0): KINGSTON SV300S37A120G
Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
Drive(1): ST31000528AS
Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
Volume(0): data
Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
Volume(1): system
Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
Volume(2): Rendszer számára fenntartott
Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
Drive(2): TSSTcorp CDDVDW SH-222AB
Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
Mount(0): asmedia-hdd on 192.168.0.186 -> smb://WORKGROUP;root@192.168.0.186/asmedia-hdd/
Type: GDaemonMount
There is still not much info about the configuration of these mounted drives. Nautilus did not show the mounted drive. This is interesting, becauase when I used the mount command in terminal the mounted drive showed up in nautilus.
I found the mount point here:
cd ~/.gvfs/smb-share\:domain\=WORKGROUP\,server\=192.168.0.186\,share\=asmedia-hdd\,user\=root/
I was able to cp from the gvfs mounted drive an mkv file and I used
watch -- du -h test.mkv
to measure the transfer speed, it was about 4.3MB/s. I used the same technique by measuring cp speed when I used the smbclient command. So I was able to reproduce what Nautilus does in the background. Now the only thing I need is adding an option to change the cifs buffer size, if that is possible.
conclusion:
I ended up adding the following to the fstab:
//192.168.0.186/asmedia-hdd /media/asmedia-hdd cifs rw,workgroup=WORKGROUP,username=root,password=xxxxx,noauto,users,iocharset=utf8 0 0
and used
chmod 4755 /usr/sbin/mount.cifs
because nautilus wrote, that only root can mount the drive instead of showing the root password prompt.
I don't like this solution, because nautilus does not discover the network drives this way. Another problem that I had to give permissions to all user to mount this drive and I had to give the smb password, because I did not have prompt for that either. The download speeds were okay, and I got the same by the upload as well. By the upload I got false speed and file size reports from nautilus, it writes 120MB/s at the beginning, which constantly decreases. By checking the file size with gvfs mounted drive I managed to get info about the real speeds. It was about 10MB/s.
I try to solve this with gvfs. If I manage to do so, I'll post an answer, but until that I'll use this cifs mounted workaround.
next ~ 2016
Added a bug report here: https://bugzilla.gnome.org/show_bug.cgi?id=762384 maybe they have an answer.
next ~ 2017
According to Gnome devs this is a Samba bug. They might write a patch, but there is a no guarantee. The Samba devs did not care about it in the past 3 years (2014-17), I am not even sure that project is maintained.
note:
I measured this 10MB/s through wifi connection. I did some measurements through ethernet with the same Odroid XU4 when I tried to debug this. (The GVFS uses libsmbclient, so it does something similar as calling smbget
.)
copy with nautilus (18-19MB/s)
# mount with nautilus on GUI
# copy with nautilus on GUI
copy with smbget default block size (23-24MB/s)
# mount with nautilus on GUI
smbget -u root -w WORKGROUP smb://192.168.0.186/asmedia-hdd/testfile
copy with smbget 16K (1-64K) block size (38-57MB/s)
# mount with nautilus on GUI
smbget -u root -w WORKGROUP smb://192.168.0.186/asmedia-hdd/testfile --blocksize=16777216
copy with CIFS mount (70-90MB/s)
# mount in fstab
//192.168.0.186/asmedia-hdd /media/asmedia-hdd cifs rw,workgroup=WORKGROUP,username=root,password=...,noauto,users,iocharset=utf8 0 0
# copy with nautilus on GUI
So an evident bottleneck is the too small block size here in GVFS, but the speed tops around 1k block size and it reaches at most 63% of the CIFS speed, so there must be another unidentified bottleneck in the smb lib.
Best Answer
Tracing the execution of
nautilus
shows that the slowness is due to a combination of two factors:It's smart about displaying useful information about each file. It looks inside the contents of files to determine what icon to use, and possibly show a preview. This can be toned down by turning previews off in the preferences.
It does a lot of useless work (such as
stat
ing each file multiple times, and checking/proc/filesystems
even for non-directories). All you can do is learn programming, improve the program and send a patch. Or at least send the authors a feature request (please make it faster).It calls several external processes for each directory, I haven't explored what they do.