I'm setting up windows file sharing on a debian wheezy headless system (NAS). The problem is that for some reason samba upload speed is ridiculously slow. Don't get me wrong, the the download speed (copying a file from the remote network share to my laptop) is completely normal - about 9MB/s which is as much as a 100 MBIT Ethernet can handle. It's just the upload speed (copying file from laptop to remote share) that is slow - about 1.8MB/s. I have no idea what's causing it. The NAS and my laptop are both connected via an ethernet cable to the same switch.
The upload used to work fine before, but then it suddenly dropped, and now it's permanently this slow. I've tried to reboot my NAS, I've tried to reboot the laptop, I've tested the network speeds from multiple laptops and a stationary computer with the same results. I've even tried different operating systems - linux, Windows XP and Windows 7. Nothing helped. I've changed the switch and the ethernet cable for a shorter and shielded CAT6, I've changed the server smb.conf multiple times with various settings/tweaks + restarted samba service. I've changed the OS kernel, I've even done a fresh install of the OS for the purpose of debugging this problem.
Here's my smb.conf:
Code:
[global]
# Server settings
workgroup = DISPLACE
server string = My File Server
netbios name = NAS-12345
# Networking settings
interfaces = lo 0.0.0.0 ::
bind interfaces only = no
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
name resolve order = bcast host lmhosts wins
os level = 65
dns proxy = no
# Log settings
log file = /var/log/samba/log.%m
max log size = 10000
syslog = 1
log level = 2
# Security settings
security = user
encrypt passwords = true
passdb backend = tdbsam
# Guest access is allowed, but with read-only permissions
guest account = nobody
map to guest = Bad User
# We don't want the printers to show up on the shares
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
# Symlinks are allowed
follow symlinks = yes
wide links = yes
unix extensions = no
# No peeking about!
hide unreadable = yes
hide special files = yes
[Storage]
comment = Data storage device
path = /tmp
browsable = yes
read only = no
public = yes
create mask = 0644
directory mask = 0755
force create mode = 0664
force directory mode = 0775
So far I know it's not a hardware problem because samba upload used to work normally before, and the fact that the FTP transfers work at full speed in both directions.
The only promising discovery I've made is this: I've installed debian wheezy afresh, booted the device (it was connected to LAN) and immediately installed samba, samba-tools and samba-common-bin with apt-get. Next I've replaced /etc/samba/smb.conf with my own (see above), and set it to export a single public share that pointed to rwx-rwx-rwx /tmp that was mounted as tmpfs in ram. Finally I restarted samba service and tested the network speeds with my fingers crossed. Voila! Uploads and downloads were working again with full speeds (about 9MB/s each).
And here's the bizzare thing. After testing the network speed I rebooted the device and re-tested the network speed. Arghhh! The upload speed now dropped back to 1.8MB/s. WTH??? No matter how many times afterwards I rebooted the device the upload speed would stay this slow. Clearly this is not a samba config problem. What could have caused samba to reduce the upload speed in that first reboot???
Any ideas?
EDIT: I was trying this out at another place, but I just brought the device back home and ran the same tests again. The full upload speed worked again! Then I rebooted the device, and it slowed down to a crawl again no matter how many times I rebooted.
There's more. I found out that if you reboot nothing happens. But if you remove the device from power for a while and boot then the full speed works again. It stops after the first soft reboot. Even after unplugging from power and booting up again the upload will slow to a crawl after I issue the command "service networking restart". Before that everything works ok.
EDIT 2: The device gets a new IP address each time it is unplugged from power, but retains the same IP during soft reboots.
EDIT 3: Does not seem to be relevant. The device got a new random mac address each reboot. For some reason it kept the IP address during soft reboots, but not during power cuts. I've fixed the device's mac address to a static one, and now it doesn't change any more during reboots, and neither does the IP address. The samba network speed still drops after first reboot/networking restart.
EDIT 4: I think I've figured out what was causing the problem. Since this was on a cubieboard ARM board, it appears that updating the kernel has fixed the problem. Apparently the ethernet driver was too unstable. The solution is to update to a more recent kernel. I am using the sunxi-3.4 branch (3.4.61) from the linux-sunxi github repository.