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!

Yeah, thank you very much @ScottW for reporting what would happen if you restore a swap file onto an existing swap file... that's great info. ... ... I'll probably add your experience to my lengthy notes! :)

I was surprised that, after the tar failure, the script just continued and rebooted as if everything was fine. Maybe adding some return code checking after the tar completes? At least "pause" if tar returns a "fatal error", so the user can see the error message?
 
I was surprised that, after the tar failure, the script just continued and rebooted as if everything was fine. Maybe adding some return code checking after the tar completes? At least "pause" if tar returns a "fatal error", so the user can see the error message?

Good feedback ... my primary concern is that after restoring the router .cfg file, that the router should be immediately rebooted. Maybe getting some more error checking in there will help before executing that final restore.
 
If you decide to add an "automatically exclude swap files from backup" feature of some kind, you can find the fully qualified path(s) with `cat /proc/swaps`.
Not having much luck with this. So what I did was back up everything, including my swap file... then tried to restore everything back to itself (with a swap file already present)

It seems the version of TAR we have on our routers does not have an option to exclude files on restore. I've specified an exclusion file, using "myswap.swp", "*.swp", ".swp" with no luck... each time a restore happens, I get the same thing:

Code:
tar: can't remove old file ./myswap.swp: Operation not permitted

Looks like the only thing I can do is catch the error to let you know this is happening, and ask you whether you want to continue with the process. At least TAR seems to exclude the swap file on a regular backup...
 
It seems the version of TAR we have on our routers does not have an option to exclude files on restore. I've specified an exclusion file, using "myswap.swp", "*.swp", ".swp" with no luck... each time a restore happens, I get the same thing:

I had the same problem, which is why I ended up manually removing the file from the tarball (on Windows, using 7zip). Though maybe I was doing something wrong, but I guess busybox tar just doesn't support it. I tried several variations like you did but couldn't get "exclude from restore" to work. I also find it odd that tar completely crashes/exits on that error -- instead of just producing a message and continuing with the rest of the files.

Looks like the only thing I can do is catch the error to let you know this is happening, and ask you whether you want to continue with the process. At least TAR seems to exclude the swap file on a regular backup...

Or excluding it from backup. Maybe a menu option "automatically exclude swap files from backup", yes/no (with default yes). If set to "yes", then the script could concatenate the contents of the manual exclusion file (if there is one) and the output from `cat /proc/swaps` into a temporary file, and then use that temporary file as the -X <filename> in the tar backup command.
 
I had the same problem, which is why I ended up manually removing the file from the tarball (on Windows, using 7zip). Though maybe I was doing something wrong, but I guess busybox tar just doesn't support it. I tried several variations like you did but couldn't get "exclude from restore" to work. I also find it odd that tar completely crashes/exits on that error -- instead of just producing a message and continuing with the rest of the files.



Or excluding it from backup. Maybe a menu option "automatically exclude swap files from backup", yes/no (with default yes). If set to "yes", then the script could concatenate the contents of the manual exclusion file (if there is one) and the output from `cat /proc/swaps` into a temporary file, and then use that temporary file as the -X <filename> in the tar backup command.

You are full of great ideas! Thanks for validating the issues I was having as well! ;)
 
Merry Christmas-Eve-Eve... A new version of BACKUPMON coming your way that include some important updates to help prevent backups of your swap file. Enjoy! :)

What's New?
v1.42 - (December 23, 2023)
- ADDED:
Added a new option #9 under the config menu based on feedback from @ScottW. This option allows you to specify if you want to back up the swap file. By default, the swap file will now be excluded from backups as we have now seen that restoring a backup with a swap file contained within will have problems restoring to a system that already has an existing swap file. If the user does not choose an exclusion file, BACKUPMON will create an exclusion file, and specify the name of the swap file to be excluded from backup. You still have the ability to maintain your own exclusion file with your own custom entries. If a custom exclusion file is in place without the swap file name included, BACKUPMON will add the swap file name to your custom exclusion file before the next backup. If you really want to back up your swap file, simply set this configuration setting to "Yes", and the script will remove any references to the swap file name from your exclusions files.
- ADDED: More logic around the restore process to catch any errors during the TAR file restore back to the External USB drive. If the process encounters any errors, you will be prompted to enter either a Y or N to proceed or stop the restore process. This was added in response to the experience that @ScottW had described, where the TAR restore encountered errors restoring the swap file, and proceeded to restore the router config, and rebooted immediately after. This will give that needed pause to determine whether or not to proceed.
- FIXED: Included some more language around the need for an exclusions.txt file, and if not used, that the user might face larger-than-normal backups which also will take much longer, because the swap file will be included in that backup. Thanks to @bibikalka for the suggestion!

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

Significant Screenshots:

New item #9 showing whether or not you want to back up the swap file. By default, this will be "no".
1703350249850.png


Item #9 expanded:
1703350313720.png


Item #8 has been added to, in order add some warnings against what the consequences are of not using an exclusion file:
1703350355908.png
 
Lots of secondary SSD makers use mystery meat for components. If it's not Samsung/Crucial - you get random stuff. I feel 2nd hand older Samsung SSDs on eBay are incredible value, and have lots of life left. Patriot stuff can be great, can be junky.
UH!? My Patriot has performed well, and it wasn't cheap...it was inexpensive!
 
Attempting to get BackUpMon going on my GT-AX6000 but as you can see by the screen shot it is not mounting the network drive. The Network Drive Is on my TrueNAS Scale (Cobia) Server (Bare Metal Installation).
I Have Tried both NFS (yeah I Know, use SMB) and SMB Sharing :p, I have the Router set as a user and in "Built-in-Admin" group, that may not be the securest way but I set it that way to get it working (I can screw it up later in further testing).

I Would like to see if NFS can be used as I Use that due to using 3 Proxmox Servers and Dual TrueNas Scale Servers, All laptops and Workstations are Linux, I may only run one of those foul and evil windows thingies in a VM.

  1. it was giving me an error for username/password, I created an ACL and resolved that problem
  2. I did try removing /tmp from /tmp/mnt/TrueNas-Backup, same error
  3. tried default setting with "target Dir Path", same error
  4. *NOTE when in Test mode and you "p: import your primary backup settings" it doesn't import your CIFS/SMB Settings with it, keeps staying at 2.1 (I am using 3.02)
  5. Also using Tried NetBios name in settings "TRUENAS01" as when using dolphin thats what name is presented in the SMB Network folders, still no Success.
  6. Directory is shared in both SMB & NFS Sections, no difference
Totally Miffed as to why it isn't working, I have tried looking at the threads here, BUT I didn't want to fiddle too much so I wouldn't screw things more inadvertently and Also if I started this Question it Might help others Using TrueNas Scale and AsusWrt-Merlin & BackUpMon.

Best Regards

Screenshot_20240108_012630.png
 
Attempting to get BackUpMon going on my GT-AX6000 but as you can see by the screen shot it is not mounting the network drive. The Network Drive Is on my TrueNAS Scale (Cobia) Server (Bare Metal Installation).
I Have Tried both NFS (yeah I Know, use SMB) and SMB Sharing :p, I have the Router set as a user and in "Built-in-Admin" group, that may not be the securest way but I set it that way to get it working (I can screw it up later in further testing).

I Would like to see if NFS can be used as I Use that due to using 3 Proxmox Servers and Dual TrueNas Scale Servers, All laptops and Workstations are Linux, I may only run one of those foul and evil windows thingies in a VM.

  1. it was giving me an error for username/password, I created an ACL and resolved that problem
  2. I did try removing /tmp from /tmp/mnt/TrueNas-Backup, same error
  3. tried default setting with "target Dir Path", same error
  4. *NOTE when in Test mode and you "p: import your primary backup settings" it doesn't import your CIFS/SMB Settings with it, keeps staying at 2.1 (I am using 3.02)
  5. Also using Tried NetBios name in settings "TRUENAS01" as when using dolphin thats what name is presented in the SMB Network folders, still no Success.
  6. Directory is shared in both SMB & NFS Sections, no difference
Totally Miffed as to why it isn't working, I have tried looking at the threads here, BUT I didn't want to fiddle too much so I wouldn't screw things more inadvertently and Also if I started this Question it Might help others Using TrueNas Scale and AsusWrt-Merlin & BackUpMon.

Best Regards

View attachment 55349
Have you attempted manually mount your NAS and see what the actual error message is?
 
Attempting to get BackUpMon going on my GT-AX6000 but as you can see by the screen shot it is not mounting the network drive. The Network Drive Is on my TrueNAS Scale (Cobia) Server (Bare Metal Installation).
I Have Tried both NFS (yeah I Know, use SMB) and SMB Sharing :p, I have the Router set as a user and in "Built-in-Admin" group, that may not be the securest way but I set it that way to get it working (I can screw it up later in further testing).

I Would like to see if NFS can be used as I Use that due to using 3 Proxmox Servers and Dual TrueNas Scale Servers, All laptops and Workstations are Linux, I may only run one of those foul and evil windows thingies in a VM.

  1. it was giving me an error for username/password, I created an ACL and resolved that problem
  2. I did try removing /tmp from /tmp/mnt/TrueNas-Backup, same error
  3. tried default setting with "target Dir Path", same error
  4. *NOTE when in Test mode and you "p: import your primary backup settings" it doesn't import your CIFS/SMB Settings with it, keeps staying at 2.1 (I am using 3.02)
  5. Also using Tried NetBios name in settings "TRUENAS01" as when using dolphin thats what name is presented in the SMB Network folders, still no Success.
  6. Directory is shared in both SMB & NFS Sections, no difference
Totally Miffed as to why it isn't working, I have tried looking at the threads here, BUT I didn't want to fiddle too much so I wouldn't screw things more inadvertently and Also if I started this Question it Might help others Using TrueNas Scale and AsusWrt-Merlin & BackUpMon.

Best Regards

View attachment 55349
  1. Try removing the existing mount point. It may have incorrect ownership or permissions.
  2. Does the target directory path exist on the NAS?
 
Backupmon has a feature by which you can test your backup drive settings ("ts" from the main menu). Great help for diagnosing problems.
 
I Have Tried both NFS (yeah I Know, use SMB) and SMB Sharing :p, I have the Router set as a user and in "Built-in-Admin" group, that may not be the securest way but I set it that way to get it working (I can screw it up later in further testing).
Is there a switch you need to throw on your NAS to enable CIFS/SMB? And I must ask... just making sure your 192.168.50.50 machine is your NAS, and that you can see that share from another device, and/or connect to it via CIFS/SMB?

I Would like to see if NFS can be used as I Use that due to using 3 Proxmox Servers and Dual TrueNas Scale Servers, All laptops and Workstations are Linux, I may only run one of those foul and evil windows thingies in a VM.
Awww Windows isn't all that bad! LOL. At this time, I don't have plans on implementing NFS... you would need to alter the script in various places to change it to your NFS preferences. @Jeffrey Young made a nice writeup based on his experiences trying to get things to work with NFS. It's definitely not as simple/cut & dry as SMB. Here's that post: https://www.snbforums.com/threads/b...drive-now-available-in-amtm.86645/post-871865

*NOTE when in Test mode and you "p: import your primary backup settings" it doesn't import your CIFS/SMB Settings with it, keeps staying at 2.1 (I am using 3.02)
Thanks for letting me know... I'll get this fixed in the next release! :)
 
Have you attempted manually mount your NAS and see what the actual error message is?
No I Haven't would the following command code be correct?
need sudo? or already root?

sudo mount -t cifs -o credentials=/etc/samba/creds,uid=3004,gid=544 //192.168.50.50/TrueNas-Backup /Router-GT-AX6000

Does this look correct?
  1. UID and GID from TrueNas Credentials -> Users ->Groups
  2. Listing for Directory full path is /mnt/TrueNas-Backup/Router-GT-AX6000
  3. I pulled the above code from - https://www.howtogeek.com/414634/how-to-mount-and-unmount-storage-devices-from-the-linux-terminal/ and I have changed it to reflect my details.
  4. I do have experiance with zfs. creating pools and and mounting them, But not with doing something this specific.
 
  1. Try removing the existing mount point. It may have incorrect ownership or permissions.
  2. Does the target directory path exist on the NAS?
1. ? try removing existing mount point from Where? TrueNas ahh NO!, Incorrect ownership or permissions, that was originally a problem as test program would say incorrect username or password. Ownership and permissions for directory is also Builtin_admin (also have sudo) so it shouldn't be a problem.
2. yes, /mnt/TrueNas-Backup/Router-GT-AX6000.
 
Is there a switch you need to throw on your NAS to enable CIFS/SMB? And I must ask... just making sure your 192.168.50.50 machine is your NAS, and that you can see that share from another device, and/or connect to it via CIFS/SMB?
There is a "Sharing" Section on TrueNas Scale where you you can add it as a "Windows(SMB) or Share "Uniix (NFS) Share" (lets you share same folder in both as well) or "Block (iSCI) Share Target".

I was able to access that folder from various Desktops and Laptops.

  1. Its pinging the server and finding it
  2. It finds the mount point exists, but nope "I won't mount it & I don't care too"
 
No I Haven't would the following command code be correct?
need sudo? or already root?

sudo mount -t cifs -o credentials=/etc/samba/creds,uid=3004,gid=544 //192.168.50.50/TrueNas-Backup /Router-GT-AX6000

Does this look correct?
  1. UID and GID from TrueNas Credentials -> Users ->Groups
  2. Listing for Directory full path is /mnt/TrueNas-Backup/Router-GT-AX6000
  3. I pulled the above code from - https://www.howtogeek.com/414634/how-to-mount-and-unmount-storage-devices-from-the-linux-terminal/ and I have changed it to reflect my details.
  4. I do have experiance with zfs. creating pools and and mounting them, But not with doing something this specific.
Assuming this is a Samba share, the syntax is;


Code:
mount -t cifs \\\\192.168.50.50\\path\\to\\folder\\on\\nas /path/to/folder/on/router -o "vers=2.1,username=userid,password=password"

Depending on the router you are using, you may need to issue this command first

Code:
modprobe md4

Note the double \\ in the UNC path as the \ has special meaning to the linix shell.
 
There is a "Sharing" Section on TrueNas Scale where you you can add it as a "Windows(SMB) or Share "Uniix (NFS) Share" (lets you share same folder in both as well) or "Block (iSCI) Share Target".

I was able to access that folder from various Desktops and Laptops.

  1. Its pinging the server and finding it
  2. It finds the mount point exists, but nope "I won't mount it & I don't care too"
I'm dying to find out if you've made any progress!
 

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