Best way to copy files within LAN to/from an OpenWrt router's USB storage

What is the best way to copy files within LAN to and from a USB storage device stuck into (mounted on) an OpenWrt router?

The router will live thousands of miles from me. The model is TP-Link C7. It has 16 MB flash.

So far I have installed OpenSSH to it. Therefore I can SFTP in and "upload" files to the USB storage device.

The problem is how to move the files out of the router's USB into the LAN's other computers (Windows or Linux).

I thought of the following:

  1. Install NFS (CIFS) client to router. After SSH-ing into router's shell, mount LAN's Linux (Windows) locations and use cp and mv.

  2. Same as 1 except also install a command line file manager (e.g. Midnight Commander) to router.

  3. Install NFS server to router. Mount router's USB storage in a Linux computer in LAN.

  4. Install Samba server to router. Mount router's USB strage in a Windows computer in LAN.

Which of the above methods or another I could not think of would be the best or standard practice?

In each method, what are some problems a person with a limited experience may overlook?

Would any of the installations (e.g. command line file manager) be too big for 16 MB flash?

If the idea of a command line file manager is not too bad, but Midnight Commander is not the most suitable, what would be? Thanks.

All options are described in the wiki, for example SFTP:
https://openwrt.org/docs/guide-user/services/nas/sftp.server

SFTP is native for modern Linux distros, and there's WinSCP for Windows users:
https://openwrt.org/docs/guide-quick-start/sshadministration#winscp

I guess it depends on your use case, but option 4 seems to be the most versatile and easy to set up. You can configure the server remotely, and then virtually any user can connect almost any device and copy the files.

samba4 might be tight, maybe take a look at the lighter ksmbd for option 3/4

1 Like

Thanks Pico. ksmbd does seem worth investigating.

Do you happen to know whether CIFS client is not too big of an install? I found this OldWiki article on it. I want to think, "When they have a how-to like that, it can't gobble up too much space." I wonder if there is some general way to find out what any package takes up on being installed. (Don't feel you have to come back to me on any of this. Questions for anyone that might know.)

No idea if there is a better way, but I'd start with looking at what opkg can do to tell you the dependency tree for a target package, and the size of each. I think there may also be a "download but don't install" option, and the space change of the packages on /tmp might be indicative of how much flash would be used.

Do you have a way to push the files from router to end-PC?

If not and each PC is pulling the file then would it be better to keep the files in a Google or Azure cloud repository to get them from directly? A similar approach I've used in the past is to have a cloud repository that a "master" device synchs with in real time as a pull operation, and internal devices use the master device,

How many files of what size will be accessed in what way? A repository of (say) PDFs for occasional read-only access will create very different demands to shared access to Excel files, etc.

You're exploring the line of making OpenWRT a networking and NAS device, which is discussed elsewhere and not (if I summarise correctly) a recommended approach. Having a "proper" storage device maybe with port forwarding to let you access it could be better.

for 21.02 version & samba4 I suggested to plan the possibility of modifying the material which is equipped with SPI flash (8 pins) without much capacity with a memory in 32M but I did not have much feedback on this request

i have modified a XIAOMI R3G with 32M SPI flash and build a new version

also my news WIFI AX TENBAY WR1800K
:

Thanks. But you wouldn't believe how un-glamorous my project is. The router will live in my mother's house, and I will be sending her some old movies from before the flood. Until now, I have SFTP-ed into her Windows computer to upload (at some 0.5 MB/sec or slower), but this required her computer to be on all the time. She does not like to have it on all the time, and she wouldn't want a NAS on either. The router's USB can receive the trickling of the movie file until the computer is on and ready. I would think this 'router as NAS' could handle that much, no?

i'd be using rsync over wireguard for this... then smbd/ksmbd on the LAN for client access...

(scp/rsync over key only ssh would also work with less setup hassle and a little less securtity)

1 Like

Thanks. I am looking into Wireguard. One of the very reasons I want an OpenWrt at my mother's house is so I could have a second public I.P. address with which (together with my own I.P. address) I could start experimenting on VPNs. To get to that experimenting stage, I have to set up something I already understand, which is SSH.

That context makes it a lot easier to think of suitable solutions. It's a very similar pattern as providing resources for a remote business office, but has very simple quality needs :slight_smile:.

Yes, I'd agree a half-decent router could handle that if it is just streaming the file and not doing any media handling (eg on the fly transcoding).

I'd still consider something like a OneDrive account that the PC syncs and you can also load files to. It's not "better" but will help keep capacity on the router for other things.

On that scenario, if the router supports it, I think that the SAMBA server is the best approach.

You can send and manage the files remotely, using a VPN plus any tool of your choice. And you can configure the shared folder as an network drive in the computer, so it's completely transparent for the user.