AMTM / Entware USB Backup?

Stephen Harrington

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!
 

visortgw

Very Senior Member
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.
 

Stephen Harrington

Senior Member
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?
 

visortgw

Very Senior Member
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.
 

Stephen Harrington

Senior Member
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! :)
 

visortgw

Very Senior Member
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.
 

Jack Yaz

Part of the Furniture
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
 

Stephen Harrington

Senior Member
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.
 

visortgw

Very Senior Member
You didn't say that you had a Synology NAS! You can also use rsync directly to the NAS from the router.
 
Last edited:

visortgw

Very Senior Member
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/ [email protected]::NetBackup/usbBackup/
rsync -a                                                                              --password-file=/jffs/scripts/rsync_pass /jffs/        [email protected]::NetBackup/jffsBackup/
When you enable rsync on the NAS, netbackup directory is created automatically.
 

Stephen Harrington

Senior Member

Latest threads

Sign Up For SNBForums Daily Digest

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