What's new

USB HDD attached to USB3 port not connecting after reboot

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

maxbraketorque

Very Senior Member
This is for an AC86U. When the drive is attached to the USB2 port, it reconnects fine across reboots, but when attached to the USB3 port, it does not reconnect after a reboot. Doesn't matter whether the USB3 port is set to USB2 or USB3 mode. Running Merlin 384 firmware. My need to use the USB3 port started when the router was on 384.15. Anyone seen this before, and if yes, have a solution for it?
 
I had this happen to me recently. I too am using AC86U. The USB drive did mount after a second reboot.

I don't know why it happened. The syslog just shows that the mount failed. I wrote a script that checks the mount point and remount the USB key if it is not present, then send me an email. I added a cron job to run the script every two hours.

I had lost some traffic history data in the progress, so now I have my rstats file saving to the /jffs partition, then a cron job that copies the file to the USB key every 6 hours.
 
I had this happen to me recently. I too am using AC86U. The USB drive did mount after a second reboot.

I don't know why it happened. The syslog just shows that the mount failed. I wrote a script that checks the mount point and remount the USB key if it is not present, then send me an email. I added a cron job to run the script every two hours.

I had lost some traffic history data in the progress, so now I have my rstats file saving to the /jffs partition, then a cron job that copies the file to the USB key every 6 hours.

Nifty. Can you post or send me a copy of the script to check and mount the HDD?
 
Or can I just ssh into the router and run a command to mount the USB3 HDD after a remote reboot?
 
Nifty. Can you post or send me a copy of the script to check and mount the HDD?

Or can I just ssh into the router and run a command to mount the USB3 HDD after a remote reboot?

You can do either....

Here is my script. The scripts checks the passed argument first. So if you wanted to check your mount point /tmp/mnt/Router, you would call the scripts as "/jffs/scripts/check-mount.sh /tmp/mnt/Router"

Run standalone or as a cron job, the scripts updates a log file at $MNTLOG and also sends text to a the $MAILFILE that my script smail.sh will email me.


Code:
#!/bin/sh

MNTLOG="/jffs/checkmount.log"
TAG="Check-Mount.sh"
MAILFILE="/tmp/Mail_Body.txt"

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" | tee $MAILFILE >> $MNTLOG
   
    if ! [  -d $1 ]
    then
        printf "$(date) - Could not find directory $1, creating\\n" | tee -a  $MAILFILE >> $MNTLOG
        mkdir $1 2>&1 | tee -a $MAILFILE >> $MNTLOG
        chmod 777 $1 2>&1 | tee -a $MAILFILE >> $MNTLOG
    fi
   
    if mount /dev/sda1 $1 2>&1
    then
        sleep 5
        service restart_nasapps
        printf "$(date) - ALERT - Had to Remount $1 ok\\n" | tee -a  $MAILFILE >> $MNTLOG
        logger -t "$TAG" " - ALERT - Had to Mount $1 had to be remounted"
    else
        printf "$(date) - FAILED TO REMOUNT $1\\n" | tee -a  $MAILFILE >> $MNTLOG
        logger -t "$TAG" "Failed to remount $1"
    fi

    /jffs/scripts/smail.sh $MAILFILE "ARERT: Mounted USB Key Alert"
else
    printf "\\n$(date) - Checked $1 - Everything is OK\n" >> $MNTLOG
    logger -t $TAG "Checked mount point $1 - Everything seems OK"
fi

You can run the above code stand alone from a ssh shell or add a line to init-start like;

Code:
cru a CheckMount "0 */2 * * * /jffs/scripts/check-mount.sh /tmp/mnt/Router"

to have the router check the mount point (in my case /tmp/mnt/Router) every two hours and remount if required.

The script /jffs/scripts/smail.sh is my custom script that I call from other scripts when I want the router to email me a status update of an event.
 
Forgot to say, credit is due where it is well deserved. Many thanks to @ColinTaylor for his help in teaching me how to mount the USB drive.

Also note that I am using Asus-Merlin w/entware here and not the stock firmware

Cheers!
 
@maxbraketorque Look in your router's syslog at boot time. If you don't see any messages similar to the ones below then it means the hardware has not been detected and scripting will not make it work.
Code:
Jan  1 00:00:18 kernel: scsi 0:0:0:0: Direct-Access     Verbatim STORE N GO       1.01 PQ: 0 ANSI: 2
Jan  1 00:00:18 kernel: sd 0:0:0:0: Attached scsi generic sg0 type 0
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] 31299584 512-byte logical blocks: (16.0 GB/14.9 GiB)
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] Write Protect is off
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan  1 00:00:18 kernel:  sda: sda1
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] Attached SCSI removable disk
 
@maxbraketorque Look in your router's syslog at boot time. If you don't see any messages similar to the ones below then it means the hardware has not been detected and scripting will not make it work.
Code:
Jan  1 00:00:18 kernel: scsi 0:0:0:0: Direct-Access     Verbatim STORE N GO       1.01 PQ: 0 ANSI: 2
Jan  1 00:00:18 kernel: sd 0:0:0:0: Attached scsi generic sg0 type 0
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] 31299584 512-byte logical blocks: (16.0 GB/14.9 GiB)
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] Write Protect is off
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan  1 00:00:18 kernel:  sda: sda1
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan  1 00:00:18 kernel: sd 0:0:0:0: [sda] Attached SCSI removable disk

@ColinTaylor, I'm not seeing anything like this in the log on the router or in the log on my syslog server. Perhaps this is due to the min log level on the router being set to "notice"? I'll probably have physical access to the AC86U again this weekend. I can experiment at that time. Thanks much.
 

Sign Up For SNBForums Daily Digest

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