More space on router with rclone

Hello everything is fine? I installed it in virtual box openwrt to test it first. I installed rclone in openwrt. I configured gooledrive with rclone, I managed to mount the disk on the first boot of the machine, but when I restart it, the disk does not mount. That's my first problem. My second problem is that I configured opkg to install packages in a specific folder on the googledrive disk mounted with rclone, but it gives a permission error, for example " package "ddns-scripts-services" postinst script returned status 126. Can anyone help?


This probably isn't a supported configuration. I'm not even sure why you are trying to use an external cloud based service to host files that should be stored locally on your system... this is for a few reasons:

  1. Google Drive (or any cloud storage) cannot be available until the network comes up. The files you're talking about need to be available immediately upon booting (which happens before the network comes up). As a result, it is not possible (or even if it is possible, it is a bad idea) to use such a service for your core router packages and config files.
  2. AFAIK, Google Drive does not present as a standard linux drive in terms of the permissions structures, so it will likely not work properly even if #1 was not an issue.

It sounds like you're using Virtual Box for your OpenWrt system. This implies that you are running it on an x86 system, which also implies that you have plenty of storage (in OpenWrt terms)... even a measly 128MB would probably be more storage than would be necessary for any normal OpenWrt installation (not counting file sharing or other general purpose media, if that is a consideration in your setup). With that said, you should be storing all of your packages and config files locally on that drive.

1 Like

First thanks for your attention. Thank you green.
I had this idea, because some homemade routers do not have enough space to install some packages.
So I had the idea of ​​using a remote disk to supply this lack.
In this case, I'm testing it first in the virtual box to not run the risk of bricking the router.
In addition, as a consequence, even if the routers have space to install packages, if the configuration files are on a remote disk, when uploading gold images on different routers, sharing the same remote folder with configuration files, there would be several equipment already configured. for the purpose and with its updated files.
In this case, my init script to mount the disk at boot looked like this:

#!/bin/sh /etc/rc.common

export PATH=/usr/bin/sbin:/usr/bin:/sbin:/bin


exec >>/root/rclone.log 2>&1

#boot() {
        #start && exit 0

start() {
        rclone mount gdrive:/ /mnt/gdrive --daemon --use-mmap --buffer-size 0 --cache-dir /tmp --vfs-cache-mode writes --vfs-cache-max-age 0s


        fusermount -uz /mnt/gdrive

it works great on the first boot, but something is still missing to mount on the restart.

When you say "homemade" are you referring to devices made for the consumer home market (all-in-one wifi router units)? If so, the amount of storage available on these devices varies considerably based on the price point and age of the device. Cheaper devices often have less memory than more expensive ones, and newer ones tend to have more than older ones.

The amount of space required depends on the specific use case and packages of interest to achieve the goals. OpenWrt requires >8MB (16MB+ preferable) of flash memory. But in that space, it is still possible to install various packages.

Also, many more recent consumer routers have USB ports, so it is easy to setup extroot to provide more local storage.

A remote disk is not suitable for things that need to be available at boot time. It would be fine for general media files that need to be shared or whatever, but not for operating system/config/application level files.

With most devices, it is fairly easy to use failsafe mode to gain access to the device when something has gone wrong with your configuration. In addition, a nice benefit of extroot is that you can actually just pull the USB drive out and the device will boot into the previously known-good state that existed prior to running the extroot process and making changes there.

This concept would only work with identical hardware, and would break if you used different devices and/or different versions of OpenWrt. The preferred way to handle this situation would be to make your own images with everything you need already 'baked-in' -- packages and config files, if desired.

OpenWrt is not designed for network booting... by the time the network has come up, the OS is mostly booted, so it can't fetch core files from a network share that would be needed for boot. Further, imagine a situation where the internet connection is not functional (a regional outage, for example) -- then what? The router wouldn't be able to boot at all. This, among other reasons, is why you need to do this stuff with local storage.

1 Like

Especially as even cheap devices often come with >=128 MB NAND flash these days. Yes, usually the vendor partitioning will only give you a fraction of that, but >=20 MB usable flash is still quite plenty for using OpenWrt as a router - and that's what it should be, a router, not a general purpose server.


I understood. I was able to create my own image and upload openwrt on an EC2 instance on AWS. Used for web server, DDNS, Openvpn, FTP and Samba4. I used openwrt, because it uses little disk and would not waste disk space just with the operating system. Another option would be to use alpine, but I like openwrt a lot and the learning curve of alpine for me would be long, very long... Also, as openwrt can be used on home routers the interaction between cloud resources and on price environments domesticos would be splendid and extremely cheap. In view of what you told me, is it then that if I make these settings on the router, would the mount at boot work? I have a tp-link 1043 router with extroot and even some partitions formatted with lvm, but I worry a lot about trying to configure it directly due to the risk of bricking. I also have a banana-pi r2 mt 7623 router. I will also try to experiment on it, as the risk of bricking is minimal. Does openwrt behave similarly on this hardware? Openwrt configuration files are very different from systems like ubuntu, so I try to adapt it the way I can, but for it is very difficult to read ubuntu tutorials and try to do it in openwrt.

"Similarity" is a vague question, it depends. OpenWrt does abstract the hardware to quite some extent (at least beyond the switch configurations, which varies wildly depending on the given hardware), so from a runtime environment/ configuration point of view, it is very similar. When it comes to low-level specifics, early boot- and boot services, bootloader interaction, ISA specifics, etc., each different SOC comes with its own specialties.

Personally I'm not really a friend of extroot, but I am using OpenWrt on 7 different targets (and it behaves largely the same) and have retired three others due to old age (15+ years and no longer reasonable to use/ not meeting minimum system requirements) . At some point it does make sense to update the hardware, rather than putting up with its deficiencies.

What is the actual goal you are trying to achieve here?

As I have stated already:

  • Mounting network storage is an option for late-stage booting (possibly useful for media sharing purposes), but not for core services and configurations. The latter needs to be handled with local storage (built-in or otherwise locally attached such as USB/SD card/SATA, etc.)
  • Bricking can happen, but is usually easy to fix using failsafe mode

I changed the opkg.conf file and it is the line dest gdrive mnt/gdrive/openwrt/etc/config/ Try installing packages with opkg install -d gdrive, but I was not happy. Error occurred. But the files appear on the googledrive disk mounted with rclone. Very strange. On the other hand, we followed the openvpn installation tutorial on the website where the OPENVPN_DIR="mnt/gdrive/" was bigger than the openvp start, it worked I will try the same thing with DDNS. But I still keep doing to mount the disk on restart. On the first boot, it's fine.
Think I'll take your advice and ditch that idea.
But I have a question: if I put this disk mount information in fstab would it work?
Do you know how a possible reconfiguration mount in the fstab of the rclone disk would look like?
On the rclone website I saw an explanation in this sense, but it was directed to sistemd/Ubuntu, I don't know how to adapt to openwrt

No, at least not in time for system services. Again, this idea is not suitable for anything other than a mount for file sharing.

It's not adaptable to OpenWrt. Period.

1 Like