Using "Save mtdblock contents" to clone a unit

Here is what I want to do:

Clone a known good OpenWrt unit into identical hardware.

The known good unit has had optional packages installed (opkg install) and other packages disabled on startup. This information is NOT saved in the normal BACKUP/RESTORE of the config files.

I was hoping that I could use the System -> Backup / Flash firmware -> Save mtdblock contents feature. Have not tried as I can not find a clear set of instructions on this forum.

BACKUP QUESTION
"Save mtdblock contents" has these options. I have no idea which option to choose.

  • u-boot
  • u-boot-env
  • firmware
  • kernel
  • rootfs
  • rootfs_data
  • cfg
  • EEPROM

RESTORE QUESTION
What command(s) would I use to restore the mtd backup into:

  1. A unit already flashed with OpenWrt
  2. [Is this even possible?] A unit that has NOT been flashed (yet) with OpenWrt. ie. has OEM firmware in it. Specifically a Ubiquiti UniFi UAP.

Thanks in advance

Wouldn't it be easier if you just copy the "overlay" partition?

1 Like

I am open to all suggestions.

Here is the output of # cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00760000 00010000 "firmware"
mtd3: 00190000 00010000 "kernel"
mtd4: 005d0000 00010000 "rootfs"
mtd5: 00360000 00010000 "rootfs_data"
mtd6: 00040000 00010000 "cfg"
mtd7: 00010000 00010000 "EEPROM"

and

.  # mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mtdblock5 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)

How would I do as you suggest?

Rob

All changes you make after installing the image go into the overlay partition. And it seems easier and less risky to export and import than a task device.

I would just use "tar" to dump the contents of "/overlay", copy the file to another router, and extract it there.

2 Likes

I tried your suggestion

  • Old unit: tar -cvzf /tmp/overlay.tar.gz /overlay
  • Copy the tar file from old to new unit
  • New unit: cd /; tar -xvzf /tmp/overlay.tar.gz

Worked perfectly!

Thanks

2 Likes

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

1 Like

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