Installing Package Software on an external drive

Hey, guys. I have a little bit of a non-standard question. Is it possible to install some Package Software on an external drive (USB drive or external HDD). Exactly some Package Software, but not all of them.

Let's say I connect an external HDD to a router, and it has a Samba server installed on it, and the server settings are also stored on the same disk.

Is this possible?

I don't think this is typically a selective process... it's usually all or none.

You could install all the packages you want on your internal storage first, then run an extroot process and install the other packages on the external storage. In practice, all the packages would also be installed on the external storage, but if you were to remove the external storage, the internal storage would contain all the previously installled packages.

1 Like

Here's a little more detail.

If I install all but a few packages on the internal storage. And then mount the external disk and run root extraction, all those packages will be duplicated to the external disk? In that case the internal disk will not be used as long as the external disk is connected? Would this be a complete replacement?

Question. Will the configurations, settings of these packages also move to the external disk? And if I change the settings and then disconnect the external disk, will the internal disk still have the old versions of the settings?


This may be an atypical use for a router, but it's something I use a lot on my PC. Remember about 10 years ago there were DVD disks with autorun. You inserted the disk into your computer's drive, and immediately the video player with the movie started. Or a more modern variant, a USB drive with an autorun of some portable program. Portable antivirus, for example.

I was thinking of doing something like that with the router. If there is no external drive, it makes no sense to keep the Samba server running and store it on the router. It would be logical to keep it on the same disk where it is needed.

Example of use. I turn off the router, connect the disk to it and start the router. The Samba server is autostarted and turned on with the router. Then I turn off the router, disconnect the external disk and turn the router back on. Samba server can not start because it is on the disconnected disk....

Yes.

Yes.

In principle, yeah, I see your reasoning. In practice, I am not aware of a way to make this work on OpenWrt. Further, you'd have to ensure that the external media's package is updated anytime you run a firmware update on your main system.

If it were a regular Windows PC, I would just create a task in the job scheduler with a link to run the program on an external drive. And this task will obviously not work if the external disk is missing. It will probably show some kind of error every time. Or create an Autorun.inf file on the external disk. I have no idea how to do this on Linux, since I am not familiar with this system at all.

Is it that important? If I update the firmware version on the router, a particular package on the external drive may not work and will also need to be updated?

You could see if this works:

Yes, critical. It's related to the kernel version -- a mismatch will prevent the system from working properly.

A symbolic links? Sounds familiar, I've used them before in Windows. But I like the directory junction even more. Is there something like that in linux? It's when a folder is in one path, but you can link that folder to another path, and in that other path the folder will work as if it were actually there. The original folder can even be on a different disk.

You can use opkg's -d option backed by usb subdirectory noted in /etc/opkg.conf like tmp ramdisk.
You can not use kmods or service daemons installed this way, you need to set lib and program paths to use them, to summarize kmods and services certainly and libs preferably go to default flash.

That would be "bind mount"