Transfer to USB attached hard drive Asus's vs Tomato firmware

Discussion in 'Tomato Firmware' started by jsmiddleton4, Dec 5, 2012.

  1. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Seems to be a debate about network/samba file transfers and if its faster with Merlin's tweaked Asus based firmware than Tomato versions or if the data transfer is about the same.

    Since I have Merlins installed at the moment I can test it and capture screen. That is posted. I'm doing large amount of file transfers but none of the flies themselves are huge.

    Wanted to transfer a large number of files to make sure the transfer rate had settled in.

    If someone has Shibby's or Toastman's and could do something similar and post a capture than we could compare instead of speculate.

    Attached Files:

  2. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Almost at the end of 50gb transfer and the speed has held nicely.

    Attached Files:

  3. digiblur

    digiblur Networkin' Nut Member

    When I tested on shibbys I was getting around 12 or 13. I haven't tested since though as I just made sure I got 10 or better and shut it down.

    Sent from a little old Note 2
  4. PBandJ

    PBandJ Addicted to LI Member

    Try using a tool like TeraCopy, not the built-in MS file copy utility (or some other file copier).
    You'll be surprised to see a nice bump in copy speeds.
  5. jsmiddleton4

    jsmiddleton4 Network Guru Member

    I'll look at TeraCopy today. Just d/l it.
  6. RMerlin

    RMerlin Network Guru Member

    If anyone wants to test the tweak on Tomato, simply edit smb.conf (it's possibly in /etc). Locate the line that says:

    use sendfile = yes
    and change it to

    use sendfile = no
    Then restart the smbd service. I don't have a Tomato router at home anymore to check the exact command line, but simply search for the "smbd" process using the following command:

    ps w
    It will show you the exact command with its arguments. It's probably something close to this:

    smbd -D -s /etc/smb.conf
    Stop smbd, and re-start it using the same arguments you noted before:

    killall smbd
    smbd -D -s /etc/smb.conf
    Give maybe a minute for your network to "stabilize", then try again your transfer.

    Note that this change will not survive reboots or anything done through the webui that might regenerate the config file and restart Samba.

    For Tomato Devs: this is my commit with the required change on Asuswrt-Merlin (I think Tomato shares the same write_smb_conf.c file, it's located in a different directory however).
  7. jsmiddleton4

    jsmiddleton4 Network Guru Member

    I went ahead and installed Tomato. Was smooth now that I've updated my CFE.

    My ext USB drive is formatted EXT3. The discussion has been about drives formatted in NTFS I do believe.

    I'm not reformatting my USB attached drive for testing purposes. Can do firmware swaps but moving files, reformatting, etc., a bit much.

    The results with Toastman's 64K going to the EXT3 drive are a tad faster in this capture but as I watched the range it is nearly identical with Merlin's.

    Again EXT3 format.

    Sure would be nice if someone with Toastman and an NTFS drive could test it.

    Attached Files:

  8. jsmiddleton4

    jsmiddleton4 Network Guru Member


    Heres is the smb.conf file from Toastman's .0500 version. I'm not sure but I think he, or someone, tweaked the buffer setting in socket options.....

    Not sure if adding the variable "use sendfile = no" is warranted and if so would it go in Global?

    He'd have to elaborate.

    interfaces = br0
    bind interfaces only = yes
    workgroup = Home-System
    netbios name = Office-Network
    server string = Asus RT-N66U
    guest account = nobody
    security = user
    map to guest = Bad User
    guest ok = yes
    guest only = no
    browseable = yes
    syslog only = yes
    timestamp logs = no
    syslog = 1
    encrypt passwords = yes
    preserve case = yes
    short preserve case = yes
    wins support = yes
    domain master = yes
    local master = yes
    preferred master = yes
    os level = 65

    path = /jffs
    writable = yes
    delete readonly = yes
    force user = root
    browseable = no
    comment = JFFS

    path = /
    browseable = no
    comment = Hidden Root

    path = /tmp/mnt/sdb1
    comment = sdb1
    writable = yes
    delete readonly = yes
    force user = root

    path = /tmp/mnt/sda1
    comment = sda1
    writable = yes
    delete readonly = yes
    force user = root
  9. koitsu

    koitsu Network Guru Member

    Disabling sendfile support is confirmed to increase throughput speed dramatically, due to bugs in the Linux kernel used in TomatoUSB pertaining to sendfile(2) support. These bugs have since been fixed in later kernel revisions, but upgrading/changing the kernel is not easily feasible given reliance upon the binary blob wireless driver provided by Broadcom.

    And yes, disabling sendfile support goes into the [global] section.

    The socket option tweaks may have an effect as well, but those would be cumulative (i.e. separate optimisations than sendfile(2)). The version of Samba that comes with TomatoUSB is quite old, so I would say leaving those socket adjustments would be wise, particularly the TCP_NODELAY, SO_RCVBUF, and SO_SNDBUF adjustments. The others are utter nonsense and always have been (the best example is SO_KEEPALIVE; that should not be there, ever. People on the Internet enjoy screwing about with things they really don't have any familiarity with, which is sad).
  10. RMerlin

    RMerlin Network Guru Member

    While researching ways to improve Samba performance, I noticed next to no improvement when trying to tweaks those buffer sizes. They were already set to the optimal values, only the sendfile option made any measurable difference.

    That same option will also give you a nice boost to the FTP server (assuming Tomato also uses vsftpd). However it did not improve performance with MiniDLNA, so that one was left untouched for me.
  11. jsmiddleton4

    jsmiddleton4 Network Guru Member

    So stop the SMB service.
    Edit the conf file and add the "use sendfile = no" line in the global section.
    Start SMB service.

    Or can I just edit the smb.conf, save it, and reboot?
  12. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Sorry, dot to "Won't survive reboot" did not connect initially.

    So reboot not good....

    How do we get this thing to "stick" permanently?
  13. jsmiddleton4

    jsmiddleton4 Network Guru Member

    The vsftpd conf file the parameter is set to "no" already.
  14. shibby20

    shibby20 Network Guru Member

    i tested this tweak some few weeks ago. Just i added use sendfile = no to custom samba configuration and save. I didn`t see any changes in transfer speed.

    As @jsmiddleton4 said, in vsftpd this paramets has default set to "no".

    To test speed over samba you can use

    My result:
    Running warmup...
    Running a 400MB file write on drive Z: 5 times...
    Iteration 1: 13,38 MB/sec
    Iteration 2: 13,47 MB/sec
    Iteration 3: 13,33 MB/sec
    Iteration 4: 13,17 MB/sec
    Iteration 5: 13,29 MB/sec
    Average (W): 13,33 MB/sec
    Running a 400MB file read on drive Z: 5 times...
    Iteration 1: 14,67 MB/sec
    Iteration 2: 14,98 MB/sec
    Iteration 3: 15,29 MB/sec
    Iteration 4: 15,41 MB/sec
    Iteration 5: 15,20 MB/sec
    Average (R): 15,11 MB/sec
  15. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Not sure what I'm comparing your results to Shibby?

    Which ones are with and without sendfile=no vs. not having the parameter in smb.conf?

    If its the case, IF mind you, that network transfers to NTFS formated devices are a bit faster with the sendfiles = no setting, is there a way to make the conf file permanently changed so it survives booting?

    My devices being EXT3 means I'm not able to test what was suggested regarding NTFS formatted device slow down.
  16. koitsu

    koitsu Network Guru Member

    Why are people having such a hard time getting this setting to be retained after reboot? If there is already a line in /etc/smb.conf that says use sendfile = yes, then this is quite easy and can be accomplished with a two lines which should probably go into Scripts -> Init, although possibly Scripts -> WAN Up would be a better choice given that it may provide enough time for Samba to start up after boot:

    /bin/sed -i 's/use sendfile = yes/use sendfile = no/' /etc/smb.conf
    /sbin/service smb restart
    I make no promises that the /sbin/service line will work correctly. Busybox's /sbin/service may behave differently than what I expect. I would provide a kill -HUP line instead, except I don't know where the pidfile is stored for smbd on these firmwares (is it in /var/run? If so, /bin/kill -HUP `cat /var/run/` would be sufficient, as Samba reloads its config when sent SIGHUP).

    There is no way to make smbd only restart if the file gets changed successfully; Busybox sed returns an exit code of 0 no matter if the command was successfully executed or not.
  17. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Not sure but maybe the file is read only as many are with Tomato?

    I can edit the file and move it into the directory. Just won't save as the old one is restored on boot.

    Your running a script on boot that changes the conf file?
  18. koitsu

    koitsu Network Guru Member

    If the file is read-only, then there is no chance you would be able to 1) edit the file, or 2) make a new file and mv/cp it into /etc. Think about it.

    Other people have asked you to settle down with your responses, and now I will ask you do the same. I didn't take the time to write what I did only to get such a reply. Come on man.
  19. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Sorry but I'm quite settled down. If you count them then yes, ONE person seems to have an issue with my asking questions and trying to learn. Do you as well?

    Not sure what you are reading in my reply that is troubling to you. I asked you a question to make sure what you were posting. Did you not want me to ask you any questions?

    Something in the Tomato firmware over writes the samba.conf file. I can change the file's properties with Filezilla, it doesn't matter. On boot, the old file from 1970 comes back.

    Do you know how to get Tomato to quit over writing the edited samba.conf file or are you just trying to scold me?
  20. lilstone87

    lilstone87 Serious Server Member

    I am one of the guy's who use a NTFS HDD, and I get around 3MB's max transferring data to my drive when using Shibby's tomato build. I currently use Merlin's build based off Asus build for the RT-N66U, as I am able to get between 12-14MB's transferring data to my NTFS drive. So if it is possible there is a fix to get transfer rates up while using a NTFS drive, I would be interested.

    As I really enjoy tomato, and it's option's available. But the poor transfer rates keep me from using tomato currently, and no I don't have the option to change the file system on the drive that's currently being used. It would be nice if what Merlin has posted solves the poor transferring rates when using a NTFS drive, and maybe someone can come up with a permanent fix in a future tomato build.
  21. RMerlin

    RMerlin Network Guru Member

    This is a different issue. Asus uses the commercial NTFS driver from Paragon, while Tomato uses the open-sourced NTFS-3G. That open source driver has pretty abysmal performance on such weak CPUs when compared to Paragon's driver. So with Tomato, I would strongly suggest going with ext3 instead, as it will make a big difference in terms of performance.
  22. jerrm

    jerrm Network Guru Member

    There is no use sendfile = yes in the default file.

    With shibby just add the line to the samba custom configuration text box in the gui. There is no need for manual (or scripted) modifications to smb.conf or service restarts for this.
  23. koitsu

    koitsu Network Guru Member

    The Tomato firmware works on a read-only filesystem model, using squashfs. The root filesystem (/) is read-only and that cannot be changed. Every time the router reboots, this filesystem is mounted.. The router also mounts the /tmp filesystem using tmpfs, which is RAM (i.e. any changes here are wiped out on reboot; it's RAM). As part of the default root filesystem, there are numerous directories which are actually symlinks into /tmp. Those directories are /etc, /home, /mnt, /root, and /var. So any file you edit in those directories are not actually modifying the flash itself, they are simply temporary placeholders stored in RAM.

    Do a ls -l / and mount and df -k sometime on the router and see for yourself.

    The firmware does have special one-offs for certain files which are built from contents of NVRAM variables, using some stock defaults from /rom/etc. AFAIK only some of Samba's defaults are modified this way, but obviously sendfile is not one of them.

    So to solve this dilemma, a person has to do what I said. The same applies to any custom one-offs that you want changed that aren't adjustable via the GUI.

    If this model bothers you or causes you a lot of grief, you should consider running a different firmware that offers you the ability to have a fully modifiable filesystem -- OpenWRT is one such example. They accomplish this in mostly the same way Tomato does, however instead of symlinks/etc. they actually "overlay" modifications performed to the filesystem on top of the read-only version. Here are some references for how OpenWRT does it:

    Read the above URLs. Don't skim them, read them. The most relevant section is "Can we switch the filesystem to be entirely JFFS2?". If none of this makes any sense, you'll need to spend some of your own time playing/learning or reading more material. This is a best-effort support forum.
  24. shibby20

    shibby20 Network Guru Member

    hmm... asus sources are gpl so can i or i can`t use this driver from asus sources and move it to tomato? what do you think Merlin??
  25. rhester72

    rhester72 Network Guru Member

    Asus licensed the driver from Paragon (it is hoped!). Asus does not have source, I'm quite sure, and you'd only be able to use the binary driver (illegally!). In

  26. RMerlin

    RMerlin Network Guru Member

    The license was granted to Asus for use on their routers with their firmware. Since Tomato is a different firmware, you wouldn't be allowed to reuse it unfortunately. Especially not if you are going to run it on other routers.

    Asuswrt-Merlin is in a kinda grey area since in essence I simply modify Asus's firmware, and it's still used only on the devices for which it was originally licensed. But if I were to start running the firmware on a totally different device for which it was not originally licensed (like a Linksys device, or even some other low-end Asus routers that do not have a license for that driver), then I would definitely be breaching the license agreement. I'm sure a hard-nosed lawyer could point me some fine prints stating that I am not allowed to do what I'm doing even, but until then, I believe in fair use and common sense.

    Come to think of it, it's likely that the same legal restrictions also apply to the binary-only Broadcom driver. I assume that Broadcom doesn't go after Tomato and DD-WRT because they consider this to be fair use.

    One thing you could do however would be to tell users how to retrieve the driver from a GPL archive, and install it on their own RT-N66U (the device for which it was licensed). It's just a kernel module, so it would technically be doable. More or less it would involve disabling NTFS-3G, and inserting the ufsd.ko module.

    This whole licensing non-sense is beyond rediculous sometimes. I was reading recently an article from someone who spent 10 mins reading and understanding the EULA for Adobe Flash Player. Did you know that according to the Flash Player license, if you were to give your computer to someone, you would legally be required to delete ALL traces of Flash Player from any backup you might have kept of that old computer? The legal fineprints are there, they just aren't being enforced because they are only a way out for Adobe in case someone were to abuse the license.

    Final disclaimer however: I am not a lawyer. And I hate legalese and all the unwarranted abuse that comes from it in the name of greed. So don't hold me to the letter of what I wrote :)
  27. asterger

    asterger Network Guru Member

    For what it's worth, have a device formatted as ext2 hooked to an E3000 running Tomato Firmware v1.28.0500 MIPSR2Toastman-RT-N K26 USB Ext and the most I've ever seen is 10.1MB/sec with a 1GB file.

    Adding 'use sendfile = no' gave no benefit to me. Of course the E3000 is lacking CPU versus the RT-N66U. Tomato Status indicated CPU Usage pegged at 100% with CPU Load 1.69/.60/.32.
  28. digiblur

    digiblur Networkin' Nut Member

    Seems like if something was implemented to just look at the router version and then determine which driver to use, that way it would only be used on the routers it was designed for. Or could it just be included at the time the firmware was compiled together?
  29. koitsu

    koitsu Network Guru Member

    No, that doesn't solve the problem either. Even if the compile-time scripts (Makefiles, etc.) actually went out and fetched some binary blobs or non-GPL code for use of that firmware build, that wouldn't comply with the GPL. You'd then have a firmware being distributed, claiming to be "TomatoUSB", with license-violating code in it.

    There are further (and existing!) complexities of this sort, such as the GUI bits being copyright by the original Tomato author, Jonathan Zarate, who people have tried to contact to get clarification and/or restrictions relaxed but has received no response.

    This is one of the main problems with some versions of the GPL -- it is a very viral license, as in it requires that everyone comply with a single mentality, and any attempt to circumvent that mentality results in a license violation. This is one of the many reasons real developers (not just "fly-by-night" coders) tend to prefer the BSD license (I myself prefer use the 2-clause BSD license in my own software), or even more amusing (yet completely legitimate) licenses like the WTFPL (look it up). These offer much more overall freedom of use and aren't viral in principle. They're much more pragmatic.

    This thread has now gone off onto 3 separate tangents. Folks wanting to hash this out should really start a new thread. :p
  30. digiblur

    digiblur Networkin' Nut Member

    Let people throw it on a usb device or something. But honestly Asus isn't going to bite the hand that feeds them. They have probably sold twice the amount of routers due to open firmware.

    Sent from a little old Note 2
  31. RMerlin

    RMerlin Network Guru Member

    The problem isn't Asus, but Paragon, who owns the rights to the NTFS driver.
  32. mstombs

    mstombs Network Guru Member

    What about Tuxera who appear to have a conflict of interests maintaining both the open-source NTFS-3G and their own high performance commercial offering?

    I have no problem with the commercial products themselves - this is ideal example for a Linux kernel module driver - providing access to Microsoft proprietary format drives, I'm sure it uses windows libraries not private copies of GPL routines.

    The Asus kernel module ufsd.ko reports:-

  33. shibby20

    shibby20 Network Guru Member

    Few things:
    - ufsd module from Asus sources cannot be loaded on Tomato because we have a depends problems - working on it.
    - module is compiled for R2 (ufsd: version magic ' mod_unload MIPS32_R2 32BIT ' should be ' mod_unload MIPS32_R1 32BIT')
    - there is not any of Licence description about Paragon licence in Asus GPL sources.
  34. shibby20

    shibby20 Network Guru Member

    i am able to load module:

    but when i try mount ntfs partition i`ve got Segmentation fault and:
  35. lilstone87

    lilstone87 Serious Server Member

    Well I would love to run tomato with the asus driver for NTFS. But I fully understand it's not legal to be included in a tomato build, if it is being used on other brand router's. I guess the next USB driver I get I will make sure to format to ext3, but the current drive I had was already ntfs format with data on it, and no where to move it to, to format the drive. Anyway's being a Windows user, what program do you suggest for me to format a drive to ext3?
  36. koitsu

    koitsu Network Guru Member

    I suggest you read this thread for how to format a drive + create an ext3 partition using TomatoUSB:

    And I have a hard time believing you have "no where to move the data (on the existing drive using NTFS) to" temporarily. You're using a computer right now, aren't you? Copy the contents from the USB drive to the computer (temporarily), hook the USB drive up to your router, follow the above guide, then copy the data from your computer over the network to the newly-formatted drive (using the Samba feature of TomatoUSB, or even something as simple as PuTTY's pscp or WinSCP -- just make sure the SSH server feature is enabled on the router, and you only need it enabled for the duration of the copy).
  37. Lost_Animal

    Lost_Animal Addicted to LI Member

    Any news from Shibby about Paragon Driver ?
  38. digiblur

    digiblur Networkin' Nut Member

    The user might not have enough space to copy the data off.

    Which to me is bad as that means a backup is not available.

    Sent from a little old Note 2
  39. unrequited

    unrequited Serious Server Member

    Has there been any more progress on this in the past month? I'm a new RT-N66U user using your Tomato build and the NTFS usb speeds rarely break 3mB/sec. I also can't find your email address on your page here:

    or anywhere else really, can you PM me your address?
  40. shibby20

    shibby20 Network Guru Member

    no progress at the moment. I have few things to do well i had to leave paragon driver for now.
  41. WhiZZ

    WhiZZ Addicted to LI Member

    Shibby, can I assume paragon driver support is still postponed?

    I have my HDD formatted in ext3, transfer speed is decent. But that severely limits its compatibility when I need to hook it up to to other devices.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice