USB HDD attached to USB3 port not connecting after reboot

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

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?
 

Jeffrey Young

Senior Member
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.
 

maxbraketorque

Very Senior Member
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?
 

Jeffrey Young

Senior Member
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.
 

Jeffrey Young

Senior Member
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!
 

ColinTaylor

Part of the Furniture
@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

Very Senior Member
@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.
 

Similar threads

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