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!

@Stephen Harrington ... please download v0.6 again. I made some changes to the way modprobe is used per @Jeffrey Young's suggestion below. You can redownload in the update menu, and it will overwrite it. ;)

This should do the trick:

Code:
      if [ $(find /lib -name md4.ko | wc -l) -gt 0 ]; then
        modprobe md4 > /dev/null    # Required now by some 388.x firmware for mounting remote drives
      fi

The following function is the method I've used for several years now whenever I want to double-check that a kernel module is already loaded or gets loaded (if available) when I need to in my own shell scripts:
Bash:
_LoadKernelModule_()
{
   if [ $# -eq 0 ] || [ -z "$1" ] ; then return 1 ; fi

   if ! lsmod | grep -qE "^${1}[ ]+" && \
      modprobe -l | grep -qE "/${1}.ko$"
   then
      echo "Loading \"${1}\" module..." ; modprobe "$1"
   fi
   if lsmod | grep -qE "^${1}[ ]+"
   then echo "Module \"${1}\" is loaded." ; return 0
   else echo "Module \"${1}\" *NOT* found." ; return 1
   fi
}

Here's an example call:
Bash:
_LoadKernelModule_  md4

My 2 cents.
 
@Viktor Jaep

Code:
find /lib -name md4.ko

Returns no result, so guess my RT-AX86 doesn’t have one? 😁

I got no unmount errors with the “new new” 0.6 on 3 consecutive runs so the “umount -l” may have done the trick?

And I agree with you about the advantages of the .tar file, it’s a very neat way to preserve everything and SMB is working fine. Disregard my previous Rsync/NFS musings! 😁
 
Well, the router crashed at about 1am this morning, so I guess QoS isn't the culprit.
 
OK - last test I can think of,

- Re-instated my QoS (The router rebooted when I did that),
- Ran your backup script
- Confirmed that I couldn't unmount the NAS
- I then unmounted it manually using "umount -l"
- Confirmed it's disappeared from "df -h"

So, we'll see how that goes.
 
Just thought I'd try this, see if would suit my wants.
It killed opkg (at the very least)!
Code:
Gilly@ripshod:/tmp/home/root# opkg install openssh-sftp-server
-sh: opkg: not found
Gilly@ripshod:/tmp/home/root#
Dear god i hope someone decides to put this back in alpha.
 
Last edited:
The following function is the method I've used for several years now whenever I want to double-check that a kernel module is already loaded or gets loaded (if available) when I need to in my own shell scripts:
Bash:
_LoadKernelModule_()
{
   if [ $# -eq 0 ] || [ -z "$1" ] ; then return 1 ; fi

   if ! lsmod | grep -qE "^${1}[ ]+" && \
      modprobe -l | grep -qE "/${1}.ko$"
   then
      echo "Loading \"${1}\" module..." ; modprobe "$1"
   fi
   if lsmod | grep -qE "^${1}[ ]+"
   then echo "Module \"${1}\" is loaded." ; return 0
   else echo "Module \"${1}\" *NOT* found." ; return 1
   fi
}

Here's an example call:
Bash:
_LoadKernelModule_  md4

My 2 cents.
Much appreciated, @Martinski!
 
Just thought I'd try this, see if would suit my wants.
It killed opkg (at the very least)!
Code:
Gilly@ripshod:/tmp/home/root# opkg install openssh-sftp-server
-sh: opkg: not found
Gilly@ripshod:/tmp/home/root#
Dear god i hope someone decides to put this back in alpha.
Lol. You're saying after running this script, that it killed opkg? By what method?
 
OK - last test I can think of,

- Re-instated my QoS (The router rebooted when I did that),
- Ran your backup script
- Confirmed that I couldn't unmount the NAS
- I then unmounted it manually using "umount -l"
- Confirmed it's disappeared from "df -h"

So, we'll see how that goes.
Wish there was something in the logs to point you in the right direction to determine the culprit of these crashes. ;(
 
Wish there was something in the logs to point you in the right direction to determine the culprit of these crashes. ;(
The random reboots seem to be a common theme in 388.4.
 
Just thought I'd try this, see if would suit my wants.
It killed opkg (at the very least)!
Code:
Gilly@ripshod:/tmp/home/root# opkg install openssh-sftp-server
-sh: opkg: not found
Gilly@ripshod:/tmp/home/root#
Dear god i hope someone decides to put this back in alpha.
I think you have more going on then just this script.
 
@Viktor Jaep yes, I’m on 388.4 as per my sig, and yes the updated 0.6 got rid of the mod probe error. Socket errors are still there, and I note that the script had trouble unmounting the share this time, but got it eventually?

Code:
BACKUPMON v0.6

Normal Backup starting in 10 seconds. Press [S]etup or [X] to override and enter RESTORE mode

Backing up to \\192.168.1.200\NetBackup mounted to /tmp/mnt/backups
Backup directory location: /asusrouter -- Frequency: Weekly

[Normal Backup Commencing]...

Messages:
STATUS: External Drive (\\192.168.1.200\NetBackup) mounted successfully under: /tmp/mnt/backups
STATUS: Daily Backup Directory successfully created.
STATUS: Finished backing up JFFS to /tmp/mnt/backups/asusrouter/Thu/jffs.tar.gz.
tar: ./entware/var/syslog-ng.ctl: socket ignored
tar: ./entware/var/run/syslog-ng/syslog-ng.ctl: socket ignored
STATUS: Finished backing up EXT Drive to /tmp/mnt/backups/asusrouter/Thu/AMTM-USB.tar.gz.
STATUS: Finished copying backupmon.sh script to /tmp/mnt/backups/asusrouter.
STATUS: Finished copying backupmon.cfg script to /tmp/mnt/backups/asusrouter.
STATUS: Finished copying exclusions script to /tmp/mnt/backups/asusrouter.
STATUS: Finished copying restore instructions.txt to /tmp/mnt/backups/asusrouter.
umount: can't unmount /tmp/mnt/backups: Device or resource busy
STATUS: External Drive (\\192.168.1.200\NetBackup) unmounted successfully.

Another efficient alternative over the “bloaty” SMB may be for your script to offer NFS as an alternative mounting strategy for those of us that can use it?

Up until yesterday when I started using BackupMon I had a very basic script I ran occasionally, based on rsync and advice and sample code from @visortgw, which all happened in this thread for reference.


My very crude final code here:-

usb-backup-nas.sh

Code:
####
# Backup AMTM-USB (USB Port 1) SSD/uSD and JFFS to NAS via RSync

rsync -av --delete --progress --exclude 'myswap.swp' --password-file=/jffs/scripts/rsync_pass /tmp/mnt/AMTM-USB nas@192.168.1.200::NetBackup

rsync -av --delete --progress --password-file=/jffs/scripts/rsync_pass /jffs nas@192.168.1.200::NetBackup
I have used rsync before and still do for other applications. It certainly has its place. Just be mindly that in your application, the target machine has to have rsyncd running and set up to authenticate the inbound connection.
 
I've restored back now so I could install sftp. But after installing this script (without running it) the opkg installer became inaccessible
Code:
opkg: not found
Restoring brought the package manager back so no real damage.
How can I make this simpler?
 
I've restored back now so I could install sftp. But after installing this script (without running it) the opkg installer became inaccessible
Code:
opkg: not found
Restoring brought the package manager back so no real damage.
How can I make this simpler?
You're saying that the simple act of just downloading the script is breaking opkg?

Do you get any errors? Check out the value of your $path both before and after the download. Does a reboot restore the path..
 
Wish there was something in the logs to point you in the right direction to determine the culprit of these crashes. ;(
No nothing,
Just normal syslog entries until the
Code:
May  5 06:05:03 kernel: klogd started: BusyBox v1.25.1 (2023-08-21 15:34:18 EDT)
entry which is the usual first message I see after a reboot
 
You're saying that the simple act of just downloading the script is breaking opkg?

Do you get any errors? Check out the value of your $path both before and after the download. Does a reboot restore the path..
I'll turn my router over to test this as there's no betas interesting me right now. Is there any way to debug this script? I'm willing to start from scratch.
Shall we start a separate thread?
 
I'll turn my router over to test this as there's no betas interesting me right now. Is there any way to debug this script? I'm willing to start from scratch.
Shall we start a separate thread?
The script is extremely simple. Installing the script without running it is like copying a text file over onto your router. It's extremely benign. Even looking through the code, the most complex it gets is mounting network drives, and using tar to copy and compress your files and folders into a zip file. That's practically it. Like Jeff said, there's got to be something more going on on your end that is causing OPKG from disappearing. I would just try installing the script again, and seeing if you see the same behavior?

Unlike some of my other scripts, this one relies solely on the tools and commands available in a vanilla copy of your firmware. I'm not installing any extra components from entware, and it's certainly not messing with any path statements or anything else. It's open source, so you can take a peek yourself! 🙂
 
Last edited:
The script is extremely simple. Installing the script without running it is like copying a text file over onto your router. It's extremely benign. Even looking through the code, the most complex it gets is mounting network drives, and using tar to copy and compress your files and folders into a zip file. That's practically it. Like Jeff said, there's got to be something more going on on your end that is causing OPKG from disappearing. I would just try installing the script again, and seeing if you see the same behavior?

Unlike some of my other scripts, this one relies solely on the tools and commands available in a vanilla copy of your firmware. I'm not installing any extra components from entware, and it's certainly not messing with any path statements or anything else. It's open source, so you can take a peek yourself! 🙂
Testing on a virgin install. Will report back 😉
 
Fresh install of Asuswrt-Merlin 3004.388.4_0.
M&M setup
Used the curl command to download to jffs
Formatted USB drive (reboot was required)

I haven't even installed this script yet
Code:
-sh: opkg: not found
What do you want me to do next @Viktor Jaep ?
 
Fresh install of Asuswrt-Merlin 3004.388.4_0.
M&M setup
Used the curl command to download to jffs
Formatted USB drive (reboot was required)

I haven't even installed this script yet
Code:
-sh: opkg: not found
What do you want me to do next @Viktor Jaep ?
Did you enable entware in AMTM?
 
Fresh install of Asuswrt-Merlin 3004.388.4_0.
M&M setup
Used the curl command to download to jffs
Formatted USB drive (reboot was required)

I haven't even installed this script yet
Code:
-sh: opkg: not found
What do you want me to do next @Viktor Jaep ?
If you formatted your USB drive, did you not just nuke Entware?
 

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