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!

Seemed to work. Have you considered making the test network connection option default to using the configured values from the setup and config menu?
I was leaving it as an open playground to allow people to try different things, using it for troubleshooting, or making a new connection to another device without screwing up their regular settings... Suppose there might be a way to import settings from the regular config... I'll look into this! :)
 
Seemed to work. Have you considered making the test network connection option default to using the configured values from the setup and config menu?
Well, that was easy enough... LOL. :p

What's new?
v1.23b2 - (TBA)
- ADDED:
Added the ability to import your primary or secondary backup settings into the Backup Target Network Connection Tester. Thanks to @PeterT for the suggestion!

Download Link:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/BACKUPMON/master/backupmon-1.23b2.sh" -o "/jffs/scripts/backupmon.sh" && chmod 755 "/jffs/scripts/backupmon.sh"

1697980675235.png
 
Well, that was easy enough... LOL. :p

What's new?
v1.23b2 - (TBA)
- ADDED:
Added the ability to import your primary or secondary backup settings into the Backup Target Network Connection Tester. Thanks to @PeterT for the suggestion!

Download Link:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/BACKUPMON/master/backupmon-1.23b2.sh" -o "/jffs/scripts/backupmon.sh" && chmod 755 "/jffs/scripts/backupmon.sh"

View attachment 53777
And working sweet as a nut.
 
Last edited:
I was leaving it as an open playground to allow people to try different things, using it for troubleshooting, or making a new connection to another device without screwing up their regular settings... Suppose there might be a way to import settings from the regular config... I'll look into this! :)
I was just thinking of the initial values being copied; one could still change them and not affect the configured values. Or ... just add an option to copy the primary (or secondary) settings to the test settings. This would save reentering the values to validate them.

OOPS. I see this is what you did!
 
I don't seem to see sda1 on my router
I have a GT-AX11000 & typing the mount command gives me:

Code:
/dev/sdb1 on /tmp/mnt/MERLIN type ext4 (rw,nodev,relatime,data=ordered)
/dev/sda2 on /tmp/mnt/TimeMachine type ext4 (rw,nodev,relatime,data=ordered)
/dev/sda3 on /tmp/mnt/Boot_OS_X type thfsplus (rw,nodev,relatime,umask=0000,uid=0,gid=0,readahead=1M,utf8)

the rest are just sysfs, tmpfs etc..

so how am I supposed to backup then?

since my Entware drive is mounted on sdb1
 
I don't seem to see sda1 on my router
I have a GT-AX11000 & typing the mount command gives me:

Code:
/dev/sdb1 on /tmp/mnt/MERLIN type ext4 (rw,nodev,relatime,data=ordered)
/dev/sda2 on /tmp/mnt/TimeMachine type ext4 (rw,nodev,relatime,data=ordered)
/dev/sda3 on /tmp/mnt/Boot_OS_X type thfsplus (rw,nodev,relatime,umask=0000,uid=0,gid=0,readahead=1M,utf8)

the rest are just sysfs, tmpfs etc..

so how am I supposed to backup then?

since my Entware drive is mounted on sdb1
What happens when you run this command?

Code:
nvram get usb_path_sda1_label

If you don't already have another device mounted, it could be that it swapped it? Did you bring this drive over from another router, and didn't format it? I'm not sure what other scenarios are out there, but if you only have 1 EXT USB drive, it should be assigned to sda1. I found this other post that mentions sda1 and sdb1 swapping... https://www.snbforums.com/threads/drive-gets-different-mount-points-after-reboot.63110/ and this: https://www.snbforums.com/threads/d...cker-released-april-02-2023.79823/post-868777

Not sure if you just need to unplug, reboot, plug it back in for it to get back to sda1? Perhaps @ColinTaylor has some advice on this one? I think worst case would be to format, disconnect, reboot router, reconnect, format using AMTM, and seeing if it now likes sda1. But again, seek advice from someone who knows what they're talking about... ;)
 
Last edited:
When you have multiple USB drives like @XxUnkn0wnxX the device order is not guaranteed. So you cannot assume that what is currently sda1 will always be the case. That's why you should always use unique volume labels rather than device names.

In fact, even with a single USB drive it's possible to get into situations where sda, becomes sdb, becomes sdc, etc.
 
When you have multiple USB drives like @XxUnkn0wnxX the device order is not guaranteed. So you cannot assume that what is currently sda1 will always be the case. That's why you should always use unique volume labels rather than device names.

In fact, even with a single USB drive it's possible to get into situations where sda, becomes sdb, becomes sdc, etc.
So you're saying it would probably be a good idea to get user input on which device they'd want backed up... using sda1 as a default, but letting them fill in the blank... sdXX... or maybe even forgo this and just go straight with /tmp/mnt/label paths... hum.
 
Last edited:
What happens when you run this command?

Code:
nvram get usb_path_sda1_label

If you don't already have another device mounted, it could be that it swapped it? Did you bring this drive over from another router, and didn't format it? I'm not sure what other scenarios are out there, but if you only have 1 EXT USB drive, it should be assigned to sda1. I found this other post that mentions sda1 and sdb1 swapping... https://www.snbforums.com/threads/drive-gets-different-mount-points-after-reboot.63110/ and this: https://www.snbforums.com/threads/d...cker-released-april-02-2023.79823/post-868777

Not sure if you just need to unplug, reboot, plug it back in for it to get back to sda1? Perhaps @ColinTaylor has some advice on this one? I think worst case would be to format, disconnect, reboot router, reconnect, format using AMTM, and seeing if it now likes sda1. But again, seek advice from someone who knows what they're talking about... ;)
Code:
nvram get usb_path_sda1_label
gives me
Code:
EFI
as the output

I have 2 devices plugged in, one is a 2TB HDD for time machine backups & the other is a 32gb thumbdrive for Merlin Entware etc..

I formatted the USB drive initially on my mac as ext4 for this router so it did not come from another setup.

& I did also name it as "MERLIN" for the volume name when I 1st set this up..
 
Last edited:
Code:
nvram get usb_path_sda1_label
gives me
Code:
EFI
as the output

I have 2 devices plugged in, one is a 2TB HDD for time machine backups & the other is a 32gb thumbdrive for Merlin Entware etc..

I formatted the USB drive initially on my mac as ext4 for this router so it did not come from another setup.

& I did also name it as "MERLIN" for the volume name when I 1st set this up..
I'm probably going to make a release of BACKUPMON here soon that includes all latest changes in the beta... but immediately following, will start working on a way for you to selectively choose which device you want to backup... based on its label. So for those... please make sure you have named your EXT USB drive! :)
 
I'm probably going to make a release of BACKUPMON here soon that includes all latest changes in the beta... but immediately following, will start working on a way for you to selectively choose which device you want to backup... based on its label. So for those... please make sure you have named your EXT USB drive! :)

or the drive's UUID could also work, it should be safer as this does not change usually unless you reformat..
you can get that with blkid

Code:
/dev/sda3: LABEL="Boot OS X" UUID="166032f7-ca81-3676-8061-6be63da7e0ed"
/dev/sda2: LABEL="TimeMachine" UUID="533c11b8-b5df-41bf-be1d-0e0a8d1e597b"
/dev/sda1: LABEL="EFI" UUID="67E3-17ED"
/dev/sdb1: LABEL="MERLIN" UUID="28b05140-9891-4972-bd1f-f241c8492d11"
 
or the drive's UUID could also work, it should be safer as this does not change usually unless you reformat..
you can get that with blkid

Code:
/dev/sda3: LABEL="Boot OS X" UUID="166032f7-ca81-3676-8061-6be63da7e0ed"
/dev/sda2: LABEL="TimeMachine" UUID="533c11b8-b5df-41bf-be1d-0e0a8d1e597b"
/dev/sda1: LABEL="EFI" UUID="67E3-17ED"
/dev/sdb1: LABEL="MERLIN" UUID="28b05140-9891-4972-bd1f-f241c8492d11"
I'll experiment... we'll see! :)
 
If you use UUID would you still be able to restore to a new (or reformatted) usb ssd?
 
If you use UUID would you still be able to restore to a new (or reformatted) usb ssd?
I'm going to guess not since it has the probability of changing on the next format... The drive label would probably still be the safest way to keep track of things in order to restore to the right device.
 
So you're saying it would probably be a good idea to get user input on which device they'd want backed up... using sda1 as a default, but letting them fill in the blank... sdXX... or maybe even forgo this and just go straight with /tmp/mnt/label paths... hum.

... but immediately following, will start working on a way for you to selectively choose which device you want to backup... based on its label. So for those... please make sure you have named your EXT USB drive! :)
I have a custom shell script that I use whenever I want to have menu-driven options so the user can select the mount point of a target USB-attached drive partition. If I understood correctly what you're trying to do, I think you could use it (perhaps with some minor changes) in your own script. If you'd like to take a look, let me know and I can put it in PasteBin.
 
I have a custom shell script that I use whenever I want to have menu-driven options so the user can select the mount point of a target USB-attached drive partition. If I understood correctly what you're trying to do, I think you could use it (perhaps with some minor changes) in your own script. If you'd like to take a look, let me know and I can put it in PasteBin.
That would be awesome, @Martinski! I was planning on displaying a list of available sdXX devices currently identified through the mount command, and having people pick the label of the device they want to have backed up. I built a simple selector in RTRMON, and was going to see if I could reuse that, but I'm totally game to see how you approach this! Thanks in advance! ;)

Edit -- this is my attempt at a menu-driven selector:

Code:
              echo -e "${CCyan}11. Would you like to override the default interface assigned${CClear}"
              echo -e "${CCyan}to your local WAN0? Typically, 'eth0' is assigned to WAN0, but${CClear}"
              echo -e "${CCyan}based on how you've rigged your router, it might be something${CClear}"
              echo -e "${CCyan}else. By default, RTRMON will automatically try to determine${CClear}"
              echo -e "${CCyan}the correct interface, however this will give you the option${CClear}"
              echo -e "${CCyan}to override it should you be using something else.${CClear}"
              echo ""
              echo -e "${CGreen}Valid interface choices:"

              ip -br link | LC_ALL=C awk '$2 == "UP" {print $1}' > $IFLIST # Extract all valid interfaces to a text file

              LINES=$(cat $IFLIST | wc -l) #Check to see how many lines are in this file

              echo -e "${CGreen}0) Auto"

              i=0 # Populate all other numbered choices
              while [ $i -ne $LINES ]
                do
                  i=$(($i+1))
                  InterfaceName=$(sed -n "${i}p" $IFLIST)
                  echo -e "$i) $InterfaceName"
                done

              echo -e "${CClear}"
              echo -e "${CYellow}(Default = 0 (Auto), or choose one of the above)${CClear}"

              while true
                do
                  read -p 'Choose Interface #: ' ChooseInterface

                  case ${ChooseInterface#[-+]} in # Make sure we're only picking an item from the list
                    *[!0-9]* | '') echo ""; echo -e "${CRed}ERROR: Please make a valid selection${CClear}"; echo "" ;;
                    * ) if [ $ChooseInterface -lt 0 ] || [ $ChooseInterface -gt $LINES ]; then echo ""; echo -e "${CRed}Please make a valid selection${CClear}"; echo ""; else break; fi ;;
                  esac

                done

              if [ -z "$ChooseInterface" ] # Assign the interface name to a variable and save it
                then
                  WANOverride="Auto"
              elif [ $ChooseInterface -eq 0 ]
                then
                  WANOverride="Auto"
              else
                WANOverride=$(sed -n "${ChooseInterface}p" $IFLIST)
              fi
 
Last edited:
That would be awesome, @Martinski! I was planning on displaying a list of available sdXX devices currently identified through the mount command, and having people pick the label of the device they want to have backed up. I built a simple selector in RTRMON, and was going to see if I could reuse that, but I'm totally game to see how you approach this! Thanks in advance! ;)
OK, my shell script is now available in PasteBin:
Bash:
curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused pastebin.com/raw/9jNL1G7C | tr -d '\r' > "$HOME/GetMountPointSelection.sh" && chmod 755 $HOME/*.sh

You can run the script "as is" just to see the menu & test what it does:
Bash:
./GetMountPointSelection.sh showtest

You would likely need to take the mount point path and extract the volume label if that's what you need, but I think you'll get the gist of it when you run it.
 
OK, my shell script is now available in PasteBin:
Bash:
curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused pastebin.com/raw/9jNL1G7C | tr -d '\r' > "$HOME/GetMountPointSelection.sh" && chmod 755 $HOME/*.sh

You can run the script "as is" just to see the menu & test what it does:
Bash:
./GetMountPointSelection.sh showtest

You would likely need to take the mount point path and extract the volume label if that's what you need, but I think you'll get the gist of it when you run it.
I can see why they pay you the big bucks! Thanks so much @Martinski! This will definitely be extremely helpful! :)
 
Last edited:
Beta is over! Testing has been done... looks like things are working... reviews seem to be good. Time to put these changes into production! :)

PLEASE NOTE: this update will require you to go into your config, and resave your passwords into proper base64 encoding. (for those running the beta, you're good!) For those still using plaintext passwords, you will be prompted to re-enter and save your config. Sorry for the inconvenience...

What's new?
v1.27 - (October 24, 2023)
- FIXED:
BACKUPMON will now remove any remaining copy of backupmon.cfg in the /jffs/scripts folder should you have performed a restore. This was causing some conflicts between it and a similar copy that was located under the /jffs/addons/backupmon.d/ folder. Thanks to @Ripshod for finding this!
- FIXED: Now testing to see if your EXT USB drive label is blank, and will require having at least a 2-char value before being able to run. It is important to name your devices, and not keep them blank/null. This wreaks havoc on all kinds of stuff. Please use this as a best-practice for any device you interact with. Just give it a name. All one word, no spaces, no crazy special characters. It's certainly easier to identify what device is having problems should you ever need to troubleshoot.
- CHANGED: Incorporated changes to the way passwords are being saved, now using the base64 method suggested by @PeterT and @ColinTaylor. Passwords are now encoded via base64 and saved to your config file. PLEASE NOTE: this change will require you to go into your config, and resave your passwords into proper base64 encoding. I've added a test to the script to determine if your passwords need to be resaved, and will direct you to the setup menu. This means your passwords can now be overly complex, using special characters, including the \ and $ characters, which normally cause all kinds of trouble in these kinds of scripts. Many thanks goes to @SomeWhereOverTheRainBow for his help coming up with a clever way to grep openssl to determine valid base64 passwords or invalid plaintext passwords!
- ADDED: Included the current model/firmware/build in the instructions.txt file, including a warning not to restore your router from an older firmware/build or model type, or you may face possibly bricking your router. This info is now also shown within the setup menu, and is written to a routerfw.txt file located under each of your backup folders. This is to keep track what router model/firmware build each backup was taken with. When going through a restore, BACKUPMON will compare your router's current model/firmware/build and compare it to the model/firmware/build found in the backup folder's routerfw.txt file... if they match, it proceeds with an uninterrupted restore. If it notices a difference, it will give you explicit warnings not to proceed, and asks you whether or not you want to continue, but won't stop you from overwriting your router with an older configuration from a previous firmware. This is done at your own risk. I built this roadblock to prevent people from possibly unknowingly damaging their routers if they happen to restore an older firmware, or think they can restore a backup from an RT-AC86U to a GT-AX6000 (or the like).
- ADDED: Included a ping test in the backup target network connection tester functionality. Thought this would be a worthy add-on when troubleshooting getting your router talking to your backup target. Please note, your backup target must have capabilities of returning icmp/ping requests to show valid results, but this won't stop the testing process.
- ADDED: Added the ability to import your primary or secondary backup settings into the Backup Target Network Connection Tester. Thanks to @PeterT for the suggestion!

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

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