What's new

BACKUPMON BACKUPMON v1.8.20 -Oct 12, 2024- Backup/Restore your Router: JFFS + NVRAM + External USB Drive! CIFS/SMB/NFS! (Now available in AMTM!)

  • 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!

So now that your signature block has a "struckthrough" utility, what is the next upcoming replacement for its slot of honor?!? 🤣

Haha, ok I’ll take the opportunity for a cheeky little request then… would you consider taking on the script to add Tailscale to the amtm menu per lonelycoders comment 🤗
 
Haha, ok I’ll take the opportunity for a cheeky little request then… would you consider taking on the script to add Tailscale to the amtm menu per lonelycoders comment 🤗
Hate to turn you down on this fabulous opportunity, @jksmurf... but I think I'll pass on it and let someone else tackle this one? ;) Not too familiar with Tailscale either... how are you using it? Just general remote access to get to your internal devices behind the router?
 
What's new?
v1.36b2 - (TBA)
- ADDED:
By popular demand, BACKUPMON now features a dedicated log file, located under /jffs/addons/backupmon.d/backupmon.log. You can access this log by hitting "vl" from the setup and operations menu, and will use the NANO text editor to open the log. Exit NANO using CTRL-X.
Is there any way to set vi/vim as the editor rather than nano ?

Pete
 
Is there any way to set vi/vim as the editor rather than nano ?

Pete
You would need to replace those few lines of "nano" code with "vi" code. At the moment, I don't have plans to make this an option. You could always call /jffs/add-ons/backupmon.d/backupmon.log with vi manually?
 
Hate to turn you down on this fabulous opportunity, @jksmurf... but I think I'll pass on it and let someone else tackle this one? ;) Not too familiar with Tailscale either... how are you using it? Just general remote access to get to your internal devices behind the router?
No problem Viktor I can imagine what might look simple to me or others ends up being a world of hurt for a coder as requests and glitches mount, so I totally respect your very polite response declining my request 🙏.

I used to use Wireguard for direct connections as Asus/Merlin’s implementation was pretty simple and iOS and Win Notebook devices could all connect quite simply and securely once set up.

However I got an ISP (who I will change eventually when the Contract expires) who offers internet only behind CGNAT, which WG doesn’t work through. This was for a holiday place about 9000kms away, for remote access to the Router, to check various IoT devices were working, turn off and on Hot Water and just generally checking if the internet was working and TBH, satisfy my inner geek. I had a static IP address for a while to get around this.

Anyway enter Tailscale with an RPi3 (also to be replaced, maybe by a direct implementation) as a subnet router, to get around CGNAT by ‘advertising’ a route. Having used Tailscale I just found it convenient to set up on various devices and you can see which devices are connected, join the Tailnet etc.

I was using an RPi4 at home (then AppleTV) as a subnet Router but I liked the idea of Tailscale on the Router (my GLiNet Beryl AX does it, but it’s a Travel Router). So this brought me to that thread in which @RandomUser777 cleverly found a way to make it work. For what I want to do (access a remote Router), it was just a nice thing to have it integrated into the Router as opposed to a separate device. I have no idea if this means it is slower or faster due to the limited CPU power.

So that’s the story 👍 (sorry for hijacking your thread btw).
 
Last edited:
Small update today to help with @maghuro's request to have restore file folders listed in date order... thank you for the suggestion, and thanks to @Martinski for his code contributions! :)

What's new?
v1.5.14 - (March 15, 2024)
- PATCH:
Thanks to @Martinski, he contributed some code to allow for the sorting of the directories when going through a restore, and are now being sorted in date order (instead of folder name order). This only seemed to be apparent when using the "weekly" backup method, as the other monthly, yearly or perpetual were already in order due to their folder naming conventions. I made a few more minor mods to this to display the foldernames in color as they did before with the "ls" command. Thanks to @maghuro for the suggestion! :)

Download links (or update directly within AMTM/BACKUPMON):
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/BACKUPMON/master/backupmon.sh" -o "/jffs/scripts/backupmon.sh" && chmod 755 "/jffs/scripts/backupmon.sh"

Significant Screenshots:

As you can see the available restoration file folders are now in date order, with the newest listed on the bottom for easy reference
1710626553777.png
 
Last edited:
But thinking about this more... if your NFS mount point is already in place, choosing the "USB" option in backupmon will not mess with mount points, and will leave them alone and not unmount them in the end. So this actually could be a simple fix of just calling it "USB/NFS". Lol :p

@smarthome-enthusiast ... wanna give that a try? :)

@Viktor Jaep Sorry for the late reply. Work has been kicking my a** lately. I've been able to mount the nfs share in /tmp/mnt/backups and tested writing to it using 'touch'. But when trying to configure the "Backup Target Mount Point" using AMTM, it only recognises the External USB Drive, ending up with same USB drive for both SOURCE and TARGET for backups. Currently experimenting on main router with nothing but luck and prayers :p But I'd be more than happy to use the development branch of the script once I've successfully backed up my router :)

I supposed I could create an option that would not attempt cifs mounts, and leaves everything else alone... like a "NFS" option, but will rely on the user to ensure that the mount points are all configured correctly. @smarthome-enthusiast ... would something like that work for you?

If possible, can we define/capture IP_Address, Share, Directory (in share) and Mount_Options (personally don't use this but could help others connect their shares with advanced options) in the script and mount & unmount during backup. Maybe something like:

Code:
mount -t nfs -o MOUNT_OPTIONS IP_ADDRESS:/SHARE /tmp/mnt/backups
<backupmon.sh in /tmp/mnt/backups/DIRECTORY>
umount /tmp/mnt/backups
 
Last edited:
@Viktor Jaep Sorry for the late reply. Work has been kicking my a** lately. I've been able to mount the nfs share in /tmp/mnt/backups and tested writing to it using 'touch'. But when trying to configure the "Backup Target Mount Point" using AMTM, it only recognises the External USB Drive, ending up with same USB drive for both SOURCE and TARGET for backups. Currently experimenting on main router with nothing but luck and prayers :p But I'd be more than happy to use the development branch of the script once I've successfully backed up my router :)
I just validated your findings (using a CIFS share) and tried to emulate what you were doing... let me start working on a resolution to this!

If possible, can we define/capture IP_Address, Share, Directory (in share) and Mount_Options (personally don't use this but could help others connect their shares with advanced options) in the script and mount & unmount during backup. Maybe something like:

Code:
mount -t nfs -o MOUNT_OPTIONS IP_ADDRESS:/SHARE /tmp/mnt/backups
<backupmon.sh in /tmp/mnt/backups/DIRECTORY>
umount /tmp/mnt/backups
That definitely sounds workable! Thanks for clarifying this...

I'll get busy... hope you don't mind me using you as an NFS guinea pig when I have some beta versions ready? :)
 
Sure thing.
v1.6.0 Beta 1 coming your way! Please know, that I have only made mods to the primary backup at this point. Secondaries, restores, test connectivity and purges are not configured yet. Let's see if we can get the main backup working over NFS, and then I'll work on the rest. Please go into the config menu, and make your selections per the screenshot below... when done, hit "bk" from the main menu (or just run "backupmon" from the prompt) and let me know how it goes!

Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/BACKUPMON/develop/backupmon.sh" -o "/jffs/scripts/backupmon.sh" && chmod 755 "/jffs/scripts/backupmon.sh"

1710783233636.png
 
Last edited:
v1.6.0 Beta 1 coming your way! Please know, that I have only made mods to the primary backup at this point. Secondaries, restores, test connectivity and purges are not configured yet. Let's see if we can get the main backup working over NFS, and then I'll work on the rest. Please go into the config menu, and make your selections per the screenshot below... when done, hit "bk" from the main menu (or just run "backupmon" from the prompt) and let me know how it goes!

Just tested it and it failed to complete the backup. Mounting with & without mount options worked and it was able to write the data. Below are the logs:

Code:
33 Mar 19 2024 11:52:31 router BACKUPMON[12091] - INFO: Successfully wrote a new config file
34 Mar 19 2024 11:53:14 router BACKUPMON[12091] - INFO: Email notification was sent successfully [TEST: BACKUPMON Email Notification].
35 Mar 19 2024 11:54:18 router BACKUPMON[12091] - INFO: External network drive ( 192.168.X.X:/volume/TestNFS ) mounted successfully under: /tmp/mnt/backups
36 Mar 19 2024 11:54:18 router BACKUPMON[12091] - INFO: Backup Directory successfully created.
37 Mar 19 2024 11:54:18 router BACKUPMON[12091] - INFO: Daily Backup Directory successfully created.
38 Mar 19 2024 11:54:20 router BACKUPMON[12091] - INFO: Finished backing up JFFS to /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/jffs.tar.gz
39 Mar 19 2024 11:54:21 router BACKUPMON[12091] - INFO: Finished integrity check for /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/jffs.tar.gz
40 Mar 19 2024 11:54:23 router BACKUPMON[12091] - INFO: Finished backing up NVRAM to /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/nvram.cfg
41 Mar 19 2024 11:54:24 router BACKUPMON[12091] - INFO: Finished copying routerfw.txt to /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/routerfw.txt
42 Mar 19 2024 11:54:25 router BACKUPMON[12091] - INFO: Starting backup of EXT Drive on Tue Mar 19 11:54:25 EAT 2024
43 Mar 19 2024 11:54:27 router BACKUPMON[12091] - **ERROR**: Errors detected creating EXT Drive tar file.
44 Mar 19 2024 11:54:33 router BACKUPMON[12091] - INFO: Email notification was sent successfully [FAILURE: Error creating EXT USB tar file]

Files in Directory:

Code:
router:/tmp/mnt# ls -aln backups/Router/ASUSMerlin/RT-AX88U/19/
drwxrwxrwx    1 1000     6554           92 Mar 19 11:54 .
drwxrwxrwx    1 1000     6554            4 Mar 19 11:54 ..
-rwxrwxrwx    1 1000     6554       977839 Mar 19 11:54 Entware.tar.gz
-rwxrwxrwx    1 1000     6554      3210266 Mar 19 11:54 jffs.tar.gz
-rwxrwxrwx    1 1000     6554        89096 Mar 19 11:54 nvram.cfg
-rwxrwxrwx    1 1000     6554           52 Mar 19 11:54 routerfw.txt
 
Just tested it and it failed to complete the backup. Mounting with & without mount options worked and it was able to write the data. Below are the logs:

Code:
33 Mar 19 2024 11:52:31 router BACKUPMON[12091] - INFO: Successfully wrote a new config file
34 Mar 19 2024 11:53:14 router BACKUPMON[12091] - INFO: Email notification was sent successfully [TEST: BACKUPMON Email Notification].
35 Mar 19 2024 11:54:18 router BACKUPMON[12091] - INFO: External network drive ( 192.168.X.X:/volume/TestNFS ) mounted successfully under: /tmp/mnt/backups
36 Mar 19 2024 11:54:18 router BACKUPMON[12091] - INFO: Backup Directory successfully created.
37 Mar 19 2024 11:54:18 router BACKUPMON[12091] - INFO: Daily Backup Directory successfully created.
38 Mar 19 2024 11:54:20 router BACKUPMON[12091] - INFO: Finished backing up JFFS to /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/jffs.tar.gz
39 Mar 19 2024 11:54:21 router BACKUPMON[12091] - INFO: Finished integrity check for /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/jffs.tar.gz
40 Mar 19 2024 11:54:23 router BACKUPMON[12091] - INFO: Finished backing up NVRAM to /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/nvram.cfg
41 Mar 19 2024 11:54:24 router BACKUPMON[12091] - INFO: Finished copying routerfw.txt to /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/routerfw.txt
42 Mar 19 2024 11:54:25 router BACKUPMON[12091] - INFO: Starting backup of EXT Drive on Tue Mar 19 11:54:25 EAT 2024
43 Mar 19 2024 11:54:27 router BACKUPMON[12091] - **ERROR**: Errors detected creating EXT Drive tar file.
44 Mar 19 2024 11:54:33 router BACKUPMON[12091] - INFO: Email notification was sent successfully [FAILURE: Error creating EXT USB tar file]

Files in Directory:

Code:
router:/tmp/mnt# ls -aln backups/Router/ASUSMerlin/RT-AX88U/19/
drwxrwxrwx    1 1000     6554           92 Mar 19 11:54 .
drwxrwxrwx    1 1000     6554            4 Mar 19 11:54 ..
-rwxrwxrwx    1 1000     6554       977839 Mar 19 11:54 Entware.tar.gz
-rwxrwxrwx    1 1000     6554      3210266 Mar 19 11:54 jffs.tar.gz
-rwxrwxrwx    1 1000     6554        89096 Mar 19 11:54 nvram.cfg
-rwxrwxrwx    1 1000     6554           52 Mar 19 11:54 routerfw.txt
Glad we're getting somewhere! The error you're getting is coming from TAR, and some kind of issue writing the file... If you could please mount your NFS drive again manually, and manually trying to run this command (please correct the /tmp/mnt statement for your EXT USB drive)

tar -zcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/yourextusbdrive

Could you see what kind of error it's coming back with?
 
Glad we're getting somewhere! The error you're getting is coming from TAR, and some kind of issue writing the file... If you could please mount your NFS drive again manually, and manually trying to run this command (please correct the /tmp/mnt statement for your EXT USB drive)

tar -zcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/yourextusbdrive

Could you see what kind of error it's coming back with?
@Viktor Jaep it was still mounted on /backups but I'm assuming it's because the backup did not complete successfully?
Anyway, this is what I got:

Code:
user@router:/tmp/mnt# tar -zcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/Drive1/
tar: empty archive
user@router:/tmp/mnt# ls -aln Drive1/
drwxrwxrwx    7 0        0             4096 Mar 10 00:00 .
drwxrwxrwx    4 0        0               80 Mar 19 11:10 ..
-rw-rw-rw-    1 0        0               32 Oct  4 19:03 .___var.txt
-rw-rw-rw-    1 0        0                0 Mar  9 19:37 .___var.txt.32
-rw-rw-rw-    1 0        0               43 Mar  9 19:37 .__folder_list.txt
-rw-rw-rw-    1 0        0                0 Mar  9 19:37 .__folder_list.txt.43
-rw-rw-rw-    1 0        0               32 Oct  4 19:03 .__user_var.txt
-rw-rw-rw-    1 0        0                0 Mar  9 19:37 .__user_var.txt.32
drwxrwxrwx    2 0        0             4096 Sep 26 20:20 .minidlna
drwxrwxrwx    4 0        0             4096 Mar 10 00:00 MerlinAU.d
drwxr-xr-x   13 0        0             4096 Feb 22 21:13 entware
drwxrwxrwx    2 0        0             4096 Mar 19 15:37 history
drwx------    2 0        0            16384 Sep 26 19:54 lost+found
-rw-rw-rw-    1 0        0        5368709120 Jan 30 16:13 myswap.swp
 
@Viktor Jaep it was still mounted on /backups but I'm assuming it's because the backup did not complete successfully?
Anyway, this is what I got:

Code:
user@router:/tmp/mnt# tar -zcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/Drive1/
tar: empty archive
user@router:/tmp/mnt# ls -aln Drive1/
drwxrwxrwx    7 0        0             4096 Mar 10 00:00 .
drwxrwxrwx    4 0        0               80 Mar 19 11:10 ..
-rw-rw-rw-    1 0        0               32 Oct  4 19:03 .___var.txt
-rw-rw-rw-    1 0        0                0 Mar  9 19:37 .___var.txt.32
-rw-rw-rw-    1 0        0               43 Mar  9 19:37 .__folder_list.txt
-rw-rw-rw-    1 0        0                0 Mar  9 19:37 .__folder_list.txt.43
-rw-rw-rw-    1 0        0               32 Oct  4 19:03 .__user_var.txt
-rw-rw-rw-    1 0        0                0 Mar  9 19:37 .__user_var.txt.32
drwxrwxrwx    2 0        0             4096 Sep 26 20:20 .minidlna
drwxrwxrwx    4 0        0             4096 Mar 10 00:00 MerlinAU.d
drwxr-xr-x   13 0        0             4096 Feb 22 21:13 entware
drwxrwxrwx    2 0        0             4096 Mar 19 15:37 history
drwx------    2 0        0            16384 Sep 26 19:54 lost+found
-rw-rw-rw-    1 0        0        5368709120 Jan 30 16:13 myswap.swp

Not sure if it matters... but make sure your EXT USB drive mount does not have that trailing slash on there... it should just be:

Code:
tar -zcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/Drive1

Other than that... the only real thing I could find about the "tar: empty archive" is that it for some reason doesn't like something about your external drive. There was a suggestion to ensure it's been checked and error-free? If you can't run a tar backup with manual commands, there's got to be something else going on.
 
@Viktor Jaep it was still mounted on /backups but I'm assuming it's because the backup did not complete successfully?
Anyway, this is what I got:

Code:
user@router:/tmp/mnt# tar -zcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/Drive1/
tar: empty archive
user@router:/tmp/mnt# ls -aln Drive1/
drwxrwxrwx    7 0        0             4096 Mar 10 00:00 .
drwxrwxrwx    4 0        0               80 Mar 19 11:10 ..
-rw-rw-rw-    1 0        0               32 Oct  4 19:03 .___var.txt
-rw-rw-rw-    1 0        0                0 Mar  9 19:37 .___var.txt.32
-rw-rw-rw-    1 0        0               43 Mar  9 19:37 .__folder_list.txt
-rw-rw-rw-    1 0        0                0 Mar  9 19:37 .__folder_list.txt.43
-rw-rw-rw-    1 0        0               32 Oct  4 19:03 .__user_var.txt
-rw-rw-rw-    1 0        0                0 Mar  9 19:37 .__user_var.txt.32
drwxrwxrwx    2 0        0             4096 Sep 26 20:20 .minidlna
drwxrwxrwx    4 0        0             4096 Mar 10 00:00 MerlinAU.d
drwxr-xr-x   13 0        0             4096 Feb 22 21:13 entware
drwxrwxrwx    2 0        0             4096 Mar 19 15:37 history
drwx------    2 0        0            16384 Sep 26 19:54 lost+found
-rw-rw-rw-    1 0        0        5368709120 Jan 30 16:13 myswap.swp
Is that a 5 GB swap? Why?
 
Code:
tar -zvcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/Entware
tar: empty archive
Not sure if it matters... but make sure your EXT USB drive mount does not have that trailing slash on there...

Run it without the trailing slash and added the verbose flag. Still got the same result:
Code:
user@router:/tmp/mnt# tar -zvcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/Drive1
tar: empty archive

Other than that... the only real thing I could find about the "tar: empty archive" is that it for some reason doesn't like something about your external drive. There was a suggestion to ensure it's been checked and error-free? If you can't run a tar backup with manual commands, there's got to be something else going on.

Is there anyway to backup without the EXT Drive for the sake of testing?
 
Run it without the trailing slash and added the verbose flag. Still got the same result:
Code:
user@router:/tmp/mnt# tar -zvcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/Drive1
tar: empty archive
What version of tar are you using? Is it the busybox v1.25.1 version, or something else? I saw another post where multiple versions of tar were causing this error...

Is there anyway to backup without the EXT Drive for the sake of testing?
This is really the whole point of trying to get a snap shot of your entire router. It seems the drive mount is holding, and that process is working well. It was able to copy the jffs.tar.gz and the config over just fine... it's got to have something to do with that external drive I'm afraid. Tar is not liking it. :(

Could there be some empty tar files that it's getting stuck on? Found another article that tar might have problems with backing up other 0 byte tar files.

To check your drive, do you have the AMTM disk check script enabled? (AMTM->dc) Then after a reboot, it will check your drive, and can use AMTM->dcl to look at the results?
 
Last edited:
Not sure if it matters... but make sure your EXT USB drive mount does not have that trailing slash on there... it should just be:

Code:
tar -zcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/Drive1

Other than that... the only real thing I could find about the "tar: empty archive" is that it for some reason doesn't like something about your external drive. There was a suggestion to ensure it's been checked and error-free? If you can't run a tar backup with manual commands, there's got to be something else going on.
I've not been following this thread so apologies if I'm missing something. But that tar command is syntactically incorrect which is why you get that error. I suspect you intended to have a dot at the end of the command:

Code:
tar -zcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/Drive1 .
 
Last edited:
I've not been following this thread so apologies if I'm missing something. But that tar command is syntactically incorrect which is why you get that error. I suspect you intended to have a dot at the end of the command:

Code:
tar -zcf /tmp/mnt/backups/Router/ASUSMerlin/RT-AX88U/19/usbdrive-test.tar.gz -C /tmp/mnt/Drive1 .
OMG... I forgot to include that in my copy & paste...:rolleyes: Thanks @ColinTaylor!
 

Similar threads

Latest threads

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