What's new

AMTM / Entware USB Backup?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Stephen Harrington

Very Senior Member
Looking for ideas/scripts to automate or “make more easy and convenient” (so I actually do it) the backup of my AMTM / Entware / Swap USB device, which in my case is a main/backup pair of Sandisk Max Endurance 64GB micro SD cards in matching Sandisk uSD-to-USB 3.0 adapters.

I’m generally pretty good with device backups but the Router USB stick is an obvious glaring “hole”. At the moment I try and occasionally grab a time when I’m the only one home, take my router (AX86U) “offline” and then do an image backup of my “stick” on a Mac computer, restore this backup to my “spare” stick, and then put the newly-cloned stick back in the router to rotate the sticks a bit and test the new one works OK. Pretty clunky but it works. This doesn’t encourage me to backup enough, and I know it! Murphy’s Law also dictates that it WILL fail at the least convenient time, as we all know! :p

Ideally there would some way I could do all this without taking the Router out of service.

Either:-

Some way of inserting my “backup” stick into the router (other USB port, RT-AX86U) and cloning it from the “live” online working copy, and then unmounting it again and “putting it on the shelf”. Happy to install extra Entware packages, and edit/run scripts via SSH.

Or:-

Some kind of backup to a network share that could then be automated or manually triggered, and could then be put back on a spare USB device in case of disaster? Also not sure HOW that restore would be done and what software would be needed?

Any clues or scripts would be appreciated.

It would be great if some version of either or both of these options were integrated into AMTM eventually as a menu command for dummies like me … I think they would become widely used if they were quick and easy.

Thanks for your consideration!
 
Simple script to backup USB to USB on the router using rsync:

Code:
#!/bin/sh

rsync -a --exclude 'myswap.swp' --exclude 'entware' /tmp/mnt/USB/ /tmp/mnt/backupUSB/
rsync -a --exclude 'share/uiDivStats.d/dnsqueries.db*' --exclude var/log/dnsmasq.* /tmp/mnt/USB/entware/ /tmp/mnt/backupUSB/old.entware/
entware needs to be backed up to a different directory so that touter doesn't confuse which device entware should be on. Rename "old.entware" to "entware" to use backupUSB.
 
Simple script to backup USB to USB on the router using rsync:
Thanks for that, I’ll begin the playing …
I assume my current backup USB, which is an exact clone down to the disk name, would need to be renamed to something different, and then running your script would get them “in sync” whenever I ran it from that point forward?
 
Thanks for that, I’ll begin the playing …
I assume my current backup USB, which is an exact clone down to the disk name, would need to be renamed to something different, and then running your script would get them “in sync” whenever I ran it from that point forward?
Yes, start with a freshly formatted disk with a different label before running script for the first time.
 
Yes, start with a freshly formatted disk with a different label before running script for the first time.
Ok, does the AMTM disk utility handle that OK if I insert my backup USB for formatting?

I ask because I’ve never actually tried having two at a time inserted and don’t want to muck it up! :)
 
Ok, does the AMTM disk utility handle that OK if I insert my backup USB for formatting?

I ask because I’ve never actually tried having two at a time inserted and don’t want to muck it up! :)
Yes, it will prompt for which to format.
 
Micro SD as a backup? I would get a backup on some spinning rust, micro sd cards have a habit of failing when you need them most
 
Micro SD as a backup?
Well, kinda interim snapshot @Jack Yaz. :)

I would then image the MicroSD to a file on “proper” SSD on my iMac, which gets backed up to another SSD, and that in turn gets backed up to my 5-bay Synology NAS, which (still) has … spinning rust!

And as an aside, I’ve seen a lot of data lost due to faulty hard drives over the years and only the odd dud SD card or USB stick, maybe I’ve been lucky but I agree they are not to be trusted. They DO seem to be better than they used to be if you stick to good brands and avoid fakes.
 
You didn't say that you had a Synology NAS! You can also use rsync directly to the NAS from the router.
 
Last edited:
Well, kinda interim snapshot @Jack Yaz. :)

I would then image the MicroSD to a file on “proper” SSD on my iMac, which gets backed up to another SSD, and that in turn gets backed up to my 5-bay Synology NAS, which (still) has … spinning rust!

And as an aside, I’ve seen a lot of data lost due to faulty hard drives over the years and only the odd dud SD card or USB stick, maybe I’ve been lucky but I agree they are not to be trusted. They DO seem to be better than they used to be if you stick to good brands and avoid fakes.
To backup directly to NAS using rsync, try something like this:

Code:
rsync -a --exclude 'myswap.swp' --exclude 'entware/share/uiDivStats.d/dnsqueries.db*' --password-file=/jffs/scripts/rsync_pass /tmp/mnt/USB/ rsync@192.168.2.3::NetBackup/usbBackup/
rsync -a                                                                              --password-file=/jffs/scripts/rsync_pass /jffs/        rsync@192.168.2.3::NetBackup/jffsBackup/
When you enable rsync on the NAS, netbackup directory is created automatically.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top