Backing up complete system

Hey guys,

First of all - happy 2018!! :slight_smile:

I am trying to make a complete backup on a LEDE system, however all the posts about doing it are (now) 5+yrs old. I was wondering - how can I backup a system, completely, with absolutely everything on it, to be easily reproduced on same model devices? As in - backup LEDE firmware, backup installed packages, backup settings, everything?
The new devices come with openwrt 15 and tftp at 192.168.1.2 to flash, so I want to create a package and just flash a ready router.

If it helps - here is the output of /proc/mtd:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "SBL1"
mtd1: 00020000 00010000 "MIBIB"
mtd2: 00060000 00010000 "QSEE"
mtd3: 00010000 00010000 "CDT"
mtd4: 00010000 00010000 "DDRPARAMS"
mtd5: 00010000 00010000 "APPSBLENV"
mtd6: 00080000 00010000 "APPSBL"
mtd7: 00010000 00010000 "ART"
mtd8: 00400000 00010000 "kernel"
mtd9: 01a80000 00010000 "rootfs"
mtd10: 01790000 00010000 "rootfs_data"
mtd11: 01e80000 00010000 "firmware"

Thank you for all and any help you can provide!
T

It seems like you simply want a backup of the device's config so you can create a custom firmware for multiple units of the same device.

See:
https://lede-project.org/docs/guide-developer/use-buildsystem#custom_files
https://lede-project.org/docs/user-guide/imagebuilder#files_variable

1 Like

Thanks!

Actually no, I do want to copy everything, including modified luci files, modified uci fiels, installed and configured modules, etc. Basically something like dd tool, but not sure exactly what and how to do it.

Yes - but if you plan to make a firmware, I'm not sure you can simply make a copy the file system(s).

In any case, you need to get a copy of the settings folder(s). Those sites above should guide you in the right direction.

If you have multiple routers that are exactly the same model, set up one how you want it then copy its whole firmware partition to a file:

cat /dev/mtd11 > /tmp/firmware.bin

SCP this file out of the router and flash it as a sysupgrade (existing OpenWrt installation is required, this is not a "factory" file). This clones the kernel, rootfs and overlay fs, thus all settings and installed packages are preserved.

3 Likes

Thank you, exactly the answer I was looking for!!

Just a quick question - if the one I set up is running latest LEDE and the target devices are running, lets say - OpenWRT 15 - would this also switch them to LEDE, or do I have to first install LEDE and then do this? I assume it will overwrite the openwrt and switch it to LEDE, but we all know what assume means lol.

Thanks again!!

mtd11 must be router specific...I don't have it in /dev.

mtd0 through mtd5 only.

Yes the partitioning varies by model.

This process copies the entire OS. The previously installed OpenWrt will be erased.

1 Like

So it looks like in my case, I would need to back up each one individually.

How would a restore look?

Restoring consists of using the "upgrade firmware" page to flash your image file.

Do this only on the same router, or one of exactly the same model. Also, NAND flash may do weird things. It is always going to work on NOR flash.

Wouldn't the individual partitions (mtd0 through mdt5) need to be merged?

Doesn't seem to follow doing an upgrade flash using 6 files.

"firmware" is a partition that is sort of an alias for the overlap of kernel, rootfs, and rootfs-data. It will be one large file.

A distribution image includes only kernel and rootfs. The data area (overlay files) is initially empty.

1 Like

I'll dump them all to .bin files and look at them with a hex editor.

Thanks.

1 Like

Unfortunately, it didn't work for me on an Archer C7 v2.

Seems like the best I can do here is to do a restore of each ART partition.

cat /tmp/mtd0.bin > /dev/mtd0

for mtd0 through mtd5.

A post was split to a new topic: Creating full backup of WRT1200AC V2

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