OpenWrt Forum Archive

Topic: poor samba/usb performance

The content of this topic has been archived on 1 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I recently changed firmware to (CHAOS CALMER (15.05.1, r48532))  on my wrt1900ac because i was hoping to find truly free DDNS.  However i havnt been able to investigate much as i have been stuck getting the usb drive and samba shares working.

At first the drive was NTFS.  However when trying to play video files across the lan using things like KODI and VLC it would play for some time then just crash.  Meaning the player would stop after a timeout.  Sometimes i could replay the file and other times i needed to restart the router.

So after reading a bit (specifically that "ntfs is a memory intensive file system") I reformatted the drive to ext4.  Now though my 10-block script is not working to auto mount on plugin (I used the second script in this help doc (not allowed links but its.... <yoursite>/doc/howto/writable_ntfs))

and when i mount it manually i get the message below, however it DOES mount and is usable after this

root@SkittlesHost:/dev# mount /dev/sda1 /export/sda1
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

So even though its usable at this point performance sucks and fairly often the drive just crashes (disappears from the samba share or times out during some operation).   

Any suggestions on what my next troubleshooting step should be?

(Last edited by owengerig on 27 Nov 2017, 16:38)

I'm currently using a WRT3200ACM as a media server. I have a USB drive attached, formatted as EXT4, that I share using SAMBA. I can feed two RPi's plus a laptop over WiFi, all running KODI, and watch a different film on each one at the same time, without glitches. We have a different device, but I am pretty sure yours should be more than capable of feeding at least one KODI instance.

If you reformatted the drive to EXT4, there is no reason to see any error related to NTFS. I guess there is some stale configuration. Search for any mention of "NTFS" in "/etc/fstab" and "/etc/config/fstab".

On the other hand, once the drive is mounted as EXT4, I see no reason why it should crash at all. I would first have a look to the logs: execute "logread -f" on a terminal, and watch the messages roll. And I would not discard a hardware issue: how is the drive being powered?

test results:

copy small file to share, works fine
copy large file, starts off strong 17mbs then drops into the kbs and eventually times out (all within 1-2 mins)

did this with logread -f running and got:

Mon Nov 27 08:45:00 2017 cron.info crond[1106]: USER root pid 11054 cmd /sbin/fan_ctrl.sh


The usb drive is powered by the usb cable (one single cable from the router to it)


"/etc/fstab" was empty
"/etc/config/fstab"

config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
        option  target  '/mnt/sda1'
        option  uuid    'bfbb3170-2f64-d301-9083-31702f64d301'
        option  enabled '0'




FYI
though my speeds were more of a steady 10mbs i didnt have issues with the share working when on stock firmware.  to me that kinda rules out a hardware issue.

i also investigated the error and found this post /viewtopic.php?id=62169
which references this script /gargoyle_mvebu/fan_daemon

after installing this my fan is constantly on high, transfer speeds are all over the place, and it still times out, but with a new error (which doesnt seem related):

Mon Nov 27 09:19:43 2017 user.warn ddns-scripts[1694]: myddns_ipv4: Updating IP at DDNS provider failed - starting retry 137/0
Mon Nov 27 09:19:45 2017 daemon.info dnsmasq-dhcp[1599]: DHCPREQUEST(br-lan) 192.168.1.204 10:a5:d0:73:14:66
Mon Nov 27 09:19:45 2017 daemon.info dnsmasq-dhcp[1599]: DHCPACK(br-lan) 192.168.1.204 10:a5:d0:73:14:66 android-41fe91312ae5b840

uninstalled this new deamon after test failed

(Last edited by owengerig on 27 Nov 2017, 18:22)

Are we talking about a USB flash drive or a USB HDD drive?
The difference in power consumption is quite significant.

HDD (it spins)
Western Digital  - My Passport Ultra
but it doesnt have another input for power, the only port on it is usb

(Last edited by owengerig on 27 Nov 2017, 22:00)

owengerig wrote:

Mon Nov 27 08:45:00 2017 cron.info crond[1106]: USER root pid 11054 cmd /sbin/fan_ctrl.sh

That is not an error at all, just CRON informing you that it executing a scheduled task.

owengerig wrote:

config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
        option  target  '/mnt/sda1'
        option  uuid    'bfbb3170-2f64-d301-9083-31702f64d301'
        option  enabled '0'

I would add an "option  fstype  'ext4'" line there, so mount does not even try NTFS.

owengerig wrote:

Mon Nov 27 09:19:43 2017 user.warn ddns-scripts[1694]: myddns_ipv4: Updating IP at DDNS provider failed - starting retry 137/0
Mon Nov 27 09:19:45 2017 daemon.info dnsmasq-dhcp[1599]: DHCPREQUEST(br-lan) 192.168.1.204 10:a5:d0:73:14:66
Mon Nov 27 09:19:45 2017 daemon.info dnsmasq-dhcp[1599]: DHCPACK(br-lan) 192.168.1.204 10:a5:d0:73:14:66 android-41fe91312ae5b840

First message is telling you your DDNS is failing, does not seem related to the USB drive after all. Other two messages are completely normal, and not an error at all.

thank you, i've changed that option but the errors on mount remain (I did reboot after changing the fstab file.  are you sure the errors are not related to the ntfs-3g package i installed?  as i mentioned the drive was originally ntfs and i didnt remove the package after reformatting.)

root@SkittlesHost:/etc/config# umount /export/sda1
root@SkittlesHost:/etc/config# mount /dev/sda1 /export/sda1
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

Also the timing out and failing operations are still an issue (also auto mount on plugin but thats not important right now).

Is there another log we can look at or monitor to see whats going on, i can replicate it every time when i try to transfer the large file.
We seem to be getting side tracked on the mounting errors but the main problem is that operations timeout/fail

(Last edited by owengerig on 28 Nov 2017, 18:22)

when mounting from the command line if you include the -t option on the mount you won't see that error because mount won't have to "test" to see what kind of filesystem is there, so if it is ext4.

mount -t ext4 /dev/sda1 /export/sda1

sda is the device sdaX is the partition

or you must place the proper options in /etc/config/fsab and then just mount -a or mount /dev/sda1

here is my stanza for my usb thumb drive

config mount
        option enabled '1'
        option target '/mnt/usb'
        option device '/dev/sda1'
        option check_fs '1'
        option auto_mount '1'

(Last edited by WWTK on 28 Nov 2017, 00:43)

here is my current fstab file

config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
        option uuid 'bfbb3170-2f64-d301-9083-31702f64d301'
        option fstype 'ext4'
        option enabled '1'
        option target '/export/sda1'
        option device '/dev/sda1'
        option auto_mount '1'
        option options rw
        option enabled_fsck 1


After further testing im getting read speeds of 30mb and it works good

but write operation speeds vary from 3-12MBs and the transfer 100% of the time fails and times out

also i was watching cpu with top and the process never got over 40% of cpu usage
5254  1316 nobody   R     3376   1%  31% /usr/sbin/smbd -F

why is it timing out and crashing?

(Last edited by owengerig on 5 Dec 2017, 18:56)

I have redone the configuration so much since my last post, but it still fails sad

i do have some more information though

when transferring via Ethernet cable I'm getting between 27-32mb/s writing speeds and the file transfers successfully!!!

when transferring via WIFI (5ghz, minimum presence on the band) I'm getting between 5-13mb/s writing speeds but still fails

The biggest difference in configuration this time around is that i dedicated 128mb of swap on my usb drive. 



config global
        option anon_swap '0'
        option anon_mount '0'
        option auto_swap '1'
        option auto_mount '1'
        option delay_root '5'
        option check_fs '0'

config swap
        option device '/dev/sda2'
        option enabled '1'

config mount
        option fstype 'ext4'
        option enabled '1'
        option auto_mount '1'
        option options 'rw'
        option enabled_fsck '1'
        option uuid '10131a80-abd1-4f10-9644-a33402a52b3e'
        option target '/mnt/usb1'

free -m results

idle:
root@OpenWrt:~# free -m
             total         used         free       shared      buffers
Mem:        255324        56904       198420         1392         7060
-/+ buffers:              49844       205480
Swap:       131068            0       131068

while transferring file:
root@OpenWrt:~# free -m
             total         used         free       shared      buffers
Mem:        255324       252320         3004         1392         7116
-/+ buffers:             245204        10120
Swap:       131068            0       131068

So i think this does revolve around out of memory, but it only happens when transferring via wifi which seems strange to me (any ideas why?).

Also my new swap is always 100% free (used = 0), never used.  any ideas why?

(Last edited by owengerig on 6 Dec 2017, 17:10)

lede seems to have fixed it
fingers crossed, if it breaks again ill report back

There is some weird issue with samba on Android too. I always have just around 300-500kb/s when sending files on or from my phones away through file share. It is since years like this, even on Android 7.1.1. When I use a ftp server I get max wifi bandwidth though.

ya but with openwrt it was crashing when writing files to the samba share, that was the main issue that lede fixed

The discussion might have continued from here.