What's new

Attached USB Key lost Samba Mount

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

Jeffrey Young

Very Senior Member
Hi all,

My attached USB key lost its mount point sometime over the last two days. Did not notice until now when I went to try to get some data from the key (traffic history). Rebooting the router remounted the key just fine. This is the first time this has happened. Router has been running smoothly for the last month.

Anyway, I would like to write a quick script to test for the mount a couple of times a day, and remount if required. Writing the script is not a problem nor is adding it as a cron job.

What I am uncertain about is the mount command that Merlin uses to mount the USB key on router startup (the actual mount command executed when the router is booting).

Any help would be appreciated.

Router is AC86U, Firmware is 384.15

Thanks
 
I think you first need to determine why and how the drive was unmounted.

If some piece of software simply unmounted it then you can just use the mount command to remount it. However, that situation shouldn't normally occur. Also, if a drive is deliberately unmounted (like through the GUI) it also has to stop the dependent services, like Samba, FTP, Media Server, etc. So these services would need to be restarted.

On the other hand if the drive became inaccessible because of a hardware issue you will not be able to remount via software. It will require some form of physical intervention.
 
I think you first need to determine why and how the drive was unmounted.

If some piece of software simply unmounted it then you can just use the mount command to remount it. However, that situation shouldn't normally occur. Also, if a drive is deliberately unmounted (like through the GUI) it also has to stop the dependent services, like Samba, FTP, Media Server, etc. So these services would need to be restarted.

On the other hand if the drive became inaccessible because of a hardware issue you will not be able to remount via software. It will require some form of physical intervention.

Thanks @ColinTaylor . I agree completely with what you are saying. Seeing that I did not notice for a couple of days, the logs have already dropped off on me to trouble shoot.

Nothing has changed, and I have already done all the standard checks on the USB key.

As a stop gap measure to try to address the issue (so far it has only happened once, so I am hoping that this is a fluke), I just want to test for the mount point, and if not found, remount the USB key. In either case, send me a note.

It is the actual mount command format is what I am trying to wrap my head around. Mounting NFS drives, remote samba drive are easy. Just not sure about the format for a attached hardware key. Any help on the command format would be useful.

Still going through the logs .....
 
Last edited:
If the drive has been "magically" unmounted by someone/something then the mount point should already exist so the following command should not be necessary:
Code:
mkdir /tmp/mnt/MYDISK

To mount the drive simply do this (assuming sda1 is the device):
Code:
mount /dev/sda1 /tmp/mnt/MYDISK

And to restart the services (which most likely would have crashed):
Code:
service restart_nasapps
 
If the drive has been "magically" unmounted by someone/something then the mount point should already exist so the following command should not be necessary:
Code:
mkdir /tmp/mnt/MYDISK

To mount the drive simply do this (assuming sda1 is the device):
Code:
mount /dev/sda1 /tmp/mnt/MYDISK

And to restart the services (which most likely would have crashed):
Code:
service restart_nasapps

@ColinTaylor Thank you. I just figured out the mount syntax just before you replied (with a little help from google). Your suggestion of adding the service restart_nasapps is useful though!! For what ever reason, I was thinking that the mount command was going to b a little more complicated :)

For now, I just want to write a simple script to test for the mount a couple of times an hour and alert me should it drop so I can tag this one down (is case my USB key is starting to fail).
 
If the drive has been "magically" unmounted by someone/something then the mount point should already exist so the following command should not be necessary:
Code:
mkdir /tmp/mnt/MYDISK

@ColinTaylor Forgot to mention, the mount point did disappear (was mounted at /tmp/mnt/Router, and that Directory disappeared).

Now that I am thinking about it, I did reboot the router a couple of days ago. The syslog.log does not go back that far though for me to see anything.
 
@ColinTaylor Forgot to mention, the mount point did disappear (was mounted at /tmp/mnt/Router, and that Directory disappeared).
If there was no mount point then either the device was deliberately unmounted through the GUI or by the scheduled disk scanner, or it never got mounted when the router booted up.
 
Hmmm, about a month ago I installed the disk checker that is associated with AMTM. I wonder if that could be causing an issue.
 
Checked the log file. I can see where the disk check ran when it was first installed (and the message about the disk being mounted 30 times without a disk check). The journal table appears to have been recovered on that run.

The next entry is the disk check today when I rebooted the router to fix the mount. Reports disk is clean.

Looking at the missing traffic history (watching that right now to determine if I am overpaying my internet package), it looks like I am missing data from the date which I first installed disk check. Can't remember if I rebooted then or just installed disk check and carried on.

Just tried a manual e2fsck and was told that device is mounted, can't continue. I am thinking that when I installed the disk check script, it ran - presumably un-mounting the USB disk before running, then the USB never got remounted as I did not reboot.

Anyway, going to monitor this now and see what happens in the future and I learned a few things today.

Thanks for all the help @ColinTaylor
 
I am thinking that when I installed the disk check script, it ran - presumably un-mounting the USB disk before running, then the USB never got remounted as I did not reboot.
It only runs when the router boots up or a device is physically plugged into a running router. It doesn't unmount the disk itself.
 
It only runs when the router boots up or a device is physically plugged into a running router. It doesn't unmount the disk itself.

How about on initial installation from AMTM (have not looked at that script yet)?
 
chalking it up to the grimlins.

Either that or I'll blame it on Covid 19
 
If the drive has been "magically" unmounted by someone/something then the mount point should already exist so the following command should not be necessary:
Code:
mkdir /tmp/mnt/MYDISK

To mount the drive simply do this (assuming sda1 is the device):
Code:
mount /dev/sda1 /tmp/mnt/MYDISK

And to restart the services (which most likely would have crashed):
Code:
service restart_nasapps

After going through the logs a couple of times I found these entries;

Code:
Mar 16 14:53:43 dnsmasq-dhcp[996]: DHCPOFFER(br0) 192.168.0.183 cc:98:8b:12:3f:b7
Mar 16 14:53:43 dnsmasq-dhcp[996]: DHCPREQUEST(br0) 192.168.0.183 cc:98:8b:12:3f:b7
Mar 16 14:53:43 dnsmasq-dhcp[996]: DHCPACK(br0) 192.168.0.183 cc:98:8b:12:3f:b7
Mar 16 14:54:26 hotplug: USB /dev/sda1(ext) failed to mount!
Mar 16 14:54:26 hotplug: USB /dev/sda1(ext) failed to mount!
Mar 16 14:56:22 rstats[1019]: Problem loading /mnt/Router/TrafficHist/tomato_rstats_04d4c41b5d88.gz. Still trying...
Mar 16 14:56:24 wlceventd: WLCEVENTD wlceventd_proc_event(420): eth5: Auth B0:6E:BF:68:3B:0A, status: 0, reason: d11 RC reserved (0)
Mar 16 14:56:24 wlceventd: WLCEVENTD wlceventd_proc_event(449): eth5: Assoc B0:6E:BF:68:3B:0A, status: 0, reason: d11 RC reserved (0)

And a minutes a half earlier, the router rebooted. So, I am assuming that maybe the USB key is starting to go flakey.

I wrote this script to check the mount point. I added a cron job to run the script every two hours.

Code:
#!/bin/sh

MNTLOG="/jffs/checkmount.log"
TAG="Check-Mount.sh"

if [ $# -eq 0 ]
then
    printf "\\n$(date) - No Mount Point Specified\\n" >> $MNTLOG
    exit
fi

if ! mount | grep $1 > /dev/null 2>&1  
then
    printf "\\n$(date) - Could not detect mount point for $1\\n" >> $MNTLOG
    if [ ! -d $1 ]
    then
        printf "$(date) - Could not find directory $1, creating\\n" >> $MNTLOG
        mkdir $1
        chmod 777 $1
    fi
   
    if mount /dev/sda1 $1
    then
        sleep 5
        service restart_nasapps
        printf "$(date) - ALERT - Had to Remount $1 ok\\n" >> $MNTLOG
        logger -t "$TAG" " - ALERT - Had to Mount $1 had to be remounted"
    else
        printf "$(date) - FAILED TO REMOUNT $1\\n" >> $MNTLOG
        logger -t "$TAG" "Failed to remount $1"
    fi
else
    printf "\\n$(date) - Checked $1 - Everything is OK\n" >> $MNTLOG
    logger -t $TAG "Checked mount point $1 - Everything seems OK"
fi

But I do have a question. to avoid loosing more rstat data, can I just enter a directory in the "tools" tab that is in the jffs folder (say /jffs/)?
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top