Full Firmware image backup

Is it possible to make a full system clone / backup. I know I can make backups via luci and restore but I have to manually install the plugin packages that I had previously. I have also seen this thread:

But again, that creates a list of plugins and redownload via feeds.

What if the feeds become dead? there is no internet to pull the plugins? The backup gets restored many years later but results in failed packages?

I'm not sure exactly how the plugins get restored but I'm guessing they have time stamps and version builds and when we restore they have to match exactly, then they get downloaded?

If possible I would like to fully offline clone my devices, a bit like using cloning software on a Windows PC, the backup would be a full 1:1 clone whereby I wouldn't need to do anything other than restore.

Is there a way I could do this?

1 Like

The purpose of this system is that it is often not advised to install older packages on newer firmwares, due to differences in kernels and perhaps also toolchains if router target was different, you would get very unexpected results with packages breaking, or not working with CLI input, sometimes something internal change the behaviour.

It is possible to redownload all packages obtained from the list, this is much safer.

OpenWrt co-exist with minimal two partitions, the /rom overlay is basicly a read only partition with the baked packages and configs (the factory defaults, and restores when reseting), this can only be defined in the make menuconfig where developers use the OpenWrt building software.

So your choices are:

You could either look into something like Attended Sysupgrade or owut not sure how well these work with gl firmware, likely with asu you lose the gl ui with owut not so sure.

Or you build OpenWrt firmware yourself, although with the loss of gl software, currently this is what I'm doing, because I wanted a factory installation with my complicated config, so I could slowly build my ultimate network, and my images automatically come with the plugins pre-installed which I need.

Here is my repo as example: click

would recommend to read the setup.sh and also look to xsdk-uci-defaults, the files directory will get placed into the root directory of the builder.

I understand however I'm basically wanting to do a full image backup and then re-image to the same device. When I said clone I meant a clone of the device that can then be exported to a img file, a bit like when you clone a SD card on a pi for example.

So if the device is currently working and stable then making the master image of the device would also work correctly after restoring as in the operating systems eyes it's the same, a full system clone.

Is it not possible to do something easily via Linux commands?

I was hoping that the full image clone / backup would also keep the current partition structure, like when you clone a C drive in Windows would also save the partition layout.

I haven't just totally ignored your post, I am going to go back and read the articles you linked. I was also just curious about other potential easy avenues.

Well if you really are determined it would be possible with the DD command, however I'm advising against this method, because it is easily possible to brick it if you write it back on the wrong blocks, even U-boot could get broken due to overlapping, I lack the information to do it, but I know it is possible, but it is a very dirty and bad method.

Thanks. I did read about the DD commands. Thanks for you useful information.

If anyone else has some input that would be greatly appreciated too.

@xize11 is there any real brick wall I could hit if I was to just restore from an archive on the firmware image I have saved on my drive (backup via luci), like how I currently do it. Yes I need to download the plugins again but the configs are already restored to the device.

My fear is that one day the 3rd party plugins might not be available to download and then I will be missing vital components that I need, hence the reason for a full backup with everything intact.

In alot of situations that will work fine, but it will not if you would make a leap between op24 and mtk sdk or reversed, alot of configs use different calls especially the wireless config.

But that also count for using a backup from one model to a completely different model router.

Luckily these backup files can be opened with 7zip, what I usually recommend is to carefully examine the contents of /etc/config especially the wireless config and the network config are the ones which have the higher chance of breaking, due to port numbering differences, or wireless driver different naming, or swconfig to DSA, often I do this when I migrate to a different device model or I go with the SDK flavours.

Then I restrict myself for copying the full /etc but instead cherry pick the configs :slight_smile:

Is there a way to save the plugins folder so to speak? I know I can navigate the folder structure via winscp so maybe I can backup plugins that way?

Like backing up luci-sqm, Upnp, ddns scripts.

No i don't think that is possible after the plugin installation it's no longer a package, but deeply installed.

The manifest of the opkg defines where it installs to, this way opkg knows to uninstall it.

The only way is using:

opkg download , which downloads it to the current location.

Or a slightly modified command which downloads it to your current Directory:

opkg list-installed | cut -f 1 -d ' ' | xargs opkg download

I would recommend to do this on /tmp may it causes space issues locking down the router, /tmp is memory it will be wiped after a reboot.

Using dd is a preferred method as it makes pristine copies of exactly what you tell it to.

In general for all SoC-level devices, to make a complete backup:

First task is to under that devices' boot process.
Second task is to make a map of the storage available (as there are several different types of storage and they will be involved at different stages of the boot process)
Third task is to run the device is a "live" mode that is not accessing any of the on-board storage ideally still with network support.
Fourth and finally is to copy the storage blocks using ssh/dd or nc/dd.

In general, this IS NOT guaranteed to make a backup that can be put on another identical device; only that device; because increasingly devices use hardware ID checks and/or crypto keys as part of the boot process. As GL-iNet is a lot more open with information about their devices enabling you to do such things (which is why we are looking at using them as white-board routers) I presume they are not using security.

Once you understand the boot process you can make a back-up of just the "user OS" partition(s) and not touch the rest of it. When people flash vanilla OpenWRT this is what they are doing and GL has conveniently built-in a web-based re-flash process on their routers.

1 Like

Ideally there would be a live state backup program. dd command isn't great on a running system. Wonder if there is a way to boot to a backup os in ram? You generally have to omit some areas from dd while copying system area.
Openwrt has some documentation for backing up various locations. Id use those ways.

I've never played with uboot. It may allow tftp copy.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.