What's new

BACKUPMON BACKUPMON v1.5.10 -Mar 1, 2024- Backup/Restore your Router: JFFS + NVRAM + External USB Drive! (**Thread closed due to age**)

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

This is my flavour, because I use diversion

exclusions.txt
Code:
myswap.swap
entware/var/log/*
entware/share/uiDivStats.d/dnsqueries.db
Isn't uiDivStats going away soon with the overhaul of Diversion?
 
How does this sound?

4.) The optional TAR exclusion list can be placed in a directory of your choice. PLEASE NOTE: By default, backupmon will back up everything, swap files, log files, included! It is a good idea to exclude these using this exclusion list file. You can create this file anywhere, but I prefer to keep things in /jffs/addons/backupmon.d and named it "exclusions.txt", just to clear the clutter. The contents of this file is simply a list of files that TAR can safely ignore during a backup. Certain files, like your swap file, or other temporary files, aren't needed when restoring a backup, and get recreated after a restore. Huge thanks to @visortgw for sharing his exclusion file... the default exclusion items list looks something like this:

exclusions.txt
Code:
myswap.swp
entware/var/log/*
skynet/skynet.log

Save this file somewhere on your router, and make sure it's properly referenced in BACKUPMON. Eliminating swap and other temp files could really speed up your backups tremendously, and save you from headaches down the road on a restore.


This is good, but there is another place, in the script itself - the configuration section (in case people don't read the post too carefully :) ). This is where I got confused! I think it should say: (Default = Blank, No Exclusions file, Everything is backed up)

Code:
Selection: 8

8. What is the Backup Exclusion File Name? This file contains a list of certain
files that you want to exclude from the backup, such as your swap file.  Please
note: Use proper notation for the path by using single forward slashes between
directories. Example below:
(Example = /jffs/addons/backupmon.d/exclusions.txt) (Default = Leave Blank)

Backup Exclusion File Name + Path:
 
This is good, but there is another place, in the script itself - the configuration section (in case people don't read the post too carefully :) ). There is where I got confused! I think it should say: (Default = Leave Blank, No Exclusions, Everything is backed up)

Code:
Selection: 8

8. What is the Backup Exclusion File Name? This file contains a list of certain
files that you want to exclude from the backup, such as your swap file.  Please
note: Use proper notation for the path by using single forward slashes between
directories. Example below:
(Example = /jffs/addons/backupmon.d/exclusions.txt) (Default = Leave Blank)

Backup Exclusion File Name + Path:
Gotcha... I'll add some wording there for the next release!
 
I have an interesting error showing it's face when restoring from a backup. Backupmon fails to restore my ssd. However, after the reboot if I run the restore again it takes. I can't figure it out, but at least there's a work-around. This happens with any backup, including with a backup from way back in September. I know, different firmware, but it's happening with backups from last week too.
I will point out that this is since a complete reinstall.

Code:
 Dec 17 2023 11:40:21 ripshod BACKUPMON[9418] - INFO: Successfully downloaded and installed BACKUPMON v1.40
 2 Dec 17 2023 11:40:51 ripshod BACKUPMON[9418] - INFO: Successfully wrote a new config file
 3 Dec 17 2023 11:41:05 ripshod BACKUPMON[9418] - WARNING: External drive mount point not set. Created under: /tmp/mnt/backups
 4 Dec 17 2023 11:41:08 ripshod BACKUPMON[9418] - INFO: External network drive ( \\10.0.0.15\storage ) mounted successfully under: /t>
 5 Dec 17 2023 11:41:50 ripshod BACKUPMON[9418] - INFO: Restoring /tmp/mnt/backups/Backups/Network/Router/20231211-011501/jffs.tar.gz>
 6 Dec 17 2023 11:42:03 ripshod BACKUPMON[9418] - WARNING: External USB drive not found. Skipping restore.
 7 Dec 17 2023 11:42:03 ripshod BACKUPMON[9418] - INFO: Restoring /tmp/mnt/backups/Backups/Network/Router/20231211-011501/nvram.cfg t>
 8 Dec 17 2023 11:42:04 ripshod BACKUPMON[9418] - INFO: Backups were successfully restored to their original locations. Forcing reboo>
 9 Dec 17 2023 11:46:01 ripshod BACKUPMON[17486] - WARNING: External drive mount point not set. Created under: /tmp/mnt/backups
10 Dec 17 2023 11:46:04 ripshod BACKUPMON[17486] - INFO: External network drive ( \\10.0.0.15\storage ) mounted successfully under: />
11 Dec 17 2023 11:46:24 ripshod BACKUPMON[17486] - INFO: Restoring /tmp/mnt/backups/Backups/Network/Router/20231211-011501/jffs.tar.g>
12 Dec 17 2023 11:46:40 ripshod BACKUPMON[17486] - INFO: Restoring /tmp/mnt/backups/Backups/Network/Router/20231211-011501/asus.tar.g>
13 Dec 17 2023 11:46:40 ripshod BACKUPMON[17486] - INFO: Restoring /tmp/mnt/backups/Backups/Network/Router/20231211-011501/nvram.cfg >
14 Dec 17 2023 11:46:41 ripshod BACKUPMON[17486] - INFO: Backups were successfully restored to their original locations. Forcing rebo>

100% repeatable on my setup - but I'm not testing any more.
 

Attachments

  • Selection_001.png
    Selection_001.png
    58 KB · Views: 24
Last edited:
I have an interesting error showing it's face when restoring from a backup. Backupmon fails to restore my ssd. However, after the reboot if I run the restore again it takes. I can't figure it out, but at least there's a work-around. This happens with any backup, including with a backup from way back in September. I know, different firmware, but it's happening with backups from last week too.
I will point out that this is since a complete reinstall.
That's strange... the part in the code where you are getting this is where it's trying to determine what your external drive label is... and if it's set to "NOTFOUND", then it skips the restore as in the error above.

How are you running the restore? Perhaps that will give more to go on... Are you running it from "backupmon -restore", or by going through the setup menu, or kicking off backupmon and hitting "X"?
 
How are you running the restore? Perhaps that will give more to go on... Are you running it from "backupmon -restore", or by going through the setup menu, or kicking off backupmon and hitting "X"?
I'm using "rs" from the Setup + Operations Menu, just as I always have done since this menu existed. It is a strange one. I understand a lot since I followed this scrip from it's birth, but this eludes me. Really strange as it recognises my ssd on the second run.

Edit: The only thing that has changed since my last successful restore is the addition of the SMB version in the config. I wonder.
 
Last edited:
I'm using "rs" from the Setup + Operations Menu, just as I always have done since this menu existed. It is a strange one. I understand a lot since I followed this scrip from it's birth, but this eludes me. Really strange as it recognises my ssd on the second run.
I'll try tracing this and see if I can figure out why this might be... but definitely strange that it would work after a reboot! I'll also try another restore over the next few days as well to see if I can replicate this.
 
I've edited my last reply.
 
Just in case I've made a simple error this is my config
Code:
USERNAME="XXXXX"
PASSWORD="UmUyXXXXXXXXXXX"
UNC="\\\\10.0.0.15\\storage"
UNCDRIVE="/tmp/mnt/backups"
EXTDRIVE="/tmp/mnt/asus"
EXTLABEL="asus"
BKDIR="/Backups/Network/Router"
BACKUPMEDIA="Network"
EXCLUSION="/jffs/addons/backupmon.d/exclusions.txt"
SMBVER="3.02"
SCHEDULE=1
SCHEDULEHRS=1
SCHEDULEMIN=15
SCHEDULEMODE="BackupAutoPurge"
FREQUENCY="P"
MODE="Basic"
PURGE=1
PURGELIMIT=90
SECONDARYSTATUS=1
SECONDARYUSER="XXXXX"
SECONDARYPWD="UmUyXXXXXXXXX"
SECONDARYUNC="\\\\10.0.0.15\\removeable"
SECONDARYUNCDRIVE="/tmp/mnt/secondarybackups"
SECONDARYBKDIR="/Router_Backups"
SECONDARYBACKUPMEDIA="Network"
SECONDARYEXCLUSION="/jffs/addons/backupmon.d/exclusions.txt"
SECONDARYFREQUENCY="P"
SECONDARYMODE="Basic"
SECONDARYPURGE=1
SECONDARYPURGELIMIT=90
 
Thank you, Viktor, for a great and GREATLY NEEDED script that is greatly appreciated! This is a pretty long chain, and exactly how others resolved the "invalid parameter" error when trying to back up to the 2nd router SSD shared via SMB got past me. However, I was able to set up primary backup to a 2nd SSD, with secondary backup to a shared folder on my laptop via SMB. So I am covered. I will be working on pinning down the restore portion later in the week.

Once again GREAT WORK and Thanks!
 
Thank you, Viktor, for a great and GREATLY NEEDED script that is greatly appreciated! This is a pretty long chain, and exactly how others resolved the "invalid parameter" error when trying to back up to the 2nd router SSD shared via SMB got past me. However, I was able to set up primary backup to a 2nd SSD, with secondary backup to a shared folder on my laptop via SMB. So I am covered. I will be working on pinning down the restore portion later in the week.

Once again GREAT WORK and Thanks!
Absolutely! Great job getting everything hooked up so you can sleep better at night! :)
 
Just in case I've made a simple error this is my config
Code:
USERNAME="XXXXX"
PASSWORD="UmUyXXXXXXXXXXX"
UNC="\\\\10.0.0.15\\storage"
UNCDRIVE="/tmp/mnt/backups"
EXTDRIVE="/tmp/mnt/asus"
EXTLABEL="asus"
BKDIR="/Backups/Network/Router"
BACKUPMEDIA="Network"
EXCLUSION="/jffs/addons/backupmon.d/exclusions.txt"
SMBVER="3.02"
SCHEDULE=1
SCHEDULEHRS=1
SCHEDULEMIN=15
SCHEDULEMODE="BackupAutoPurge"
FREQUENCY="P"
MODE="Basic"
PURGE=1
PURGELIMIT=90
SECONDARYSTATUS=1
SECONDARYUSER="XXXXX"
SECONDARYPWD="UmUyXXXXXXXXX"
SECONDARYUNC="\\\\10.0.0.15\\removeable"
SECONDARYUNCDRIVE="/tmp/mnt/secondarybackups"
SECONDARYBKDIR="/Router_Backups"
SECONDARYBACKUPMEDIA="Network"
SECONDARYEXCLUSION="/jffs/addons/backupmon.d/exclusions.txt"
SECONDARYFREQUENCY="P"
SECONDARYMODE="Basic"
SECONDARYPURGE=1
SECONDARYPURGELIMIT=90

I have been tracing this and not coming up with anything solid... sorry, @Ripshod.

Ultimately, the script determined that you initially did not have a USB drive, and then after a reboot, it determined you did have a USB drive. I can't explain why. A reboot really should not matter in this case. Could the USB drive have been offline, and then came online after a reboot? Cable not plugged in all the way, then plugged in completely on reboot? No telling... I'm also assuming you left your USB drive label the same, and left it as "asus", correct? Did you format your USB drive when you did the complete wipe, and create a swapfile immediately afterwards, enable JFFS, etc. per the instructions? I'm assuming yes, since you do have quite a bit of familiarity with the script.

So the way I came up with determining if you have a USB drive or not, is by using this... feel free to run these statements one after another, and post your results below:

Code:
USBPRODUCT="$(nvram get usb_path1_product)"
echo $USBPRODUCT
USBPATH="$(nvram get usb_path1_fs_path0)"
echo $USBPATH
EXTLABEL="$(nvram get usb_path_"$USBPATH"_label)"
echo $EXTLABEL

If both the USBPATH and USBPRODUCT values are null, then it assigns a "NOTFOUND" to the USB label, and uses that throughout the script to exclude backing up or restoring from the USB drive, and only backs up/restores JFFS/NVRAM.

Determining whether someone has a valid USB drive has been tricky... if anyone has a better, safer and more reliable way of determining if someone has a legit USB drive plugged in, please do share your knowledge. ;)

EDIT: @Ripshod ... the only other thing that happened between prior-to-the-reboot and after-the-reboot is that you restored your NVRAM on that first round, then rebooted. I'm wondering if that put some settings back in place that made your USB drive visible to the script again?
 
Last edited:
That's why I thought I'd messed the settings up.
I always format the drive to ntfs in windows, then format it to ext4 in amtm with 2GB swapfile and labeled "asus". Install entware then SFTP server and start the restore. The drive always shows in the gui and the swapfile is always mounted in amtm. I just don't understand it, but like I said at least I have a workaround.
Next time I'll try standard ftp to copy the two files across - I normally disable this in the gui.
 
That's why I thought I'd messed the settings up.
I always format the drive to ntfs in windows, then format it to ext4 in amtm with 2GB swapfile and labeled "asus". Install entware then SFTP server and start the restore. The drive always shows in the gui and the swapfile is always mounted in amtm. I just don't understand it, but like I said at least I have a workaround.
Next time I'll try standard ftp - I normally disable this in the gui.
Glad you have a workaround for sure... ;) Can't wait to give the restoration process another shot on this end! LOL
 
I hope you never need to 🍺
It's mostly for fun, and to make sure that everything is still working as it should! :) Glad we have a holiday break coming up in these next few weeks that will give me some time to tear everything down, and build back up! LOL
 
Next time I'll try standard ftp to copy the two files across - I normally disable this in the gui.
Instead of FTP, you could also use WinSCP as a viable alternative to copy files across over SSH:

 
Instead of FTP, you could also use WinSCP as a viable alternative to copy files across over SSH:

I'll install that today and give it a try if I need to restore again. Is there a Linux version?
 
Instead of FTP, you could also use WinSCP as a viable alternative to copy files across over SSH:

Isn't WinSCP simply an FTP client, just like FileZilla? SFTP uses SSH.
 

Similar 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