[SOLVED] USB external HD remounted each day with new device number
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
USB external HD remounted each day with new device number
Although everything seems to be working as expected, inspection of the messages log shows that my external hard drive has been disconnected and then reconnected as a new device with the next device number. The relevant lines from /var/log/messages are:
Quote:
Jun 29 03:17:19 <MyComp> kernel: [838882.195091] usb 1-5: USB disconnect, device number 11
Jun 29 03:17:19 <MyComp> kernel: [838882.510169] usb 1-5: new full-speed USB device number 12 using xhci_hcd
Jun 29 03:17:20 <MyComp> kernel: [838882.659849] usb 1-5: New USB device found, idVendor=8087, idProduct=07dc
Jun 29 03:17:20 <MyComp> kernel: [838882.659864] usb 1-5: New USB device strings: Mfr=0, Product=0, SerialNumber=0
The device is a Western Digital Passport 2TB that I use as a backup drive. The disconnect occurs nightly approx three to four hours after backup (using several cp -a commands). The machine is in use as a server providing network storage, hosting a couple of VirtualBox VMs, and so needs to remain running 24/7.
This is on a Gigabyte BRIX GB-BACE-3150 with 4GB RAM running Debian 9. uname -r returns "4.9.0-6-amd64". /sbin/lsusb does not exist.
Two questions: 1. Is this a problem? and 2. How can I resolve this so that either the HD remains connected or it is reconnected with the same device number?
1) Yes
2) Find out what the problem is - probably hardware. USB port , cable, cleaner kicking it ...
Power would be my bet - I've seen similar when the USB port can't supply sufficient. I habitually use external powered devices, or a powered hub these days.
As for the mounting problem, use UUID or maybe better in this case LABEL in fstab.
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Rep:
Quote:
Originally Posted by Geoff_L
Although everything seems to be working as expected, inspection of the messages log shows that my external hard drive has been disconnected and then reconnected as a new device with the next device number. The relevant lines from /var/log/messages are:
The device is a Western Digital Passport 2TB that I use as a backup drive. The disconnect occurs nightly approx three to four hours after backup (using several cp -a commands). The machine is in use as a server providing network storage, hosting a couple of VirtualBox VMs, and so needs to remain running 24/7.
This is on a Gigabyte BRIX GB-BACE-3150 with 4GB RAM running Debian 9. uname -r returns "4.9.0-6-amd64". /sbin/lsusb does not exist.
Two questions: 1. Is this a problem? and 2. How can I resolve this so that either the HD remains connected or it is reconnected with the same device number?
Thanks for any help, Geoff
Do your backups complete without error?
You may not have the "usbutils" package installed. It may have a slightly different name depending on you're Linux distribution - the "usbutils" package that is.
EDIT: syg00 beat me to it! I was still typing when he replied.
Last edited by jsbjsb001; 06-29-2018 at 03:30 AM.
Reason: typos and corrections
I am using UUID in fstab to mount the USB drive on empty folder /media/usb01, viz:
Quote:
# USB01 was on /dev/sdb1 originally
UUID=0a7ee614-7199-4594-88e8-3c48c06b96f0 /media/usb01 ext4 errors=remount-ro 0 1
However, the drive hasn't remounted RO as the backup completes each night (I have the backup script direct stdout to a log file that I inspect each morning). I'm now wondering whether the pass parameter of 1 is correct as I've just read some docs that suggest only the root volume should have pass=1 and everything else should have either 0 or a value >1. I'll check the docs to find out how to use LABEL in fstab instead of UUID.
The box is mounted to the back wall of a cupboard and powered by a UPS within the same cupboard, so I doubt that the cleaner (which would be me) is kicking the cable. However, it's a mini-ITX board and so the power might not be up to it, though it seems weird to me that the disconnect/reconnect happens once only per 24 hours and then three to four hours after the backup completes! I'll try swapping to a different USB port. If I exhaust all other possiblities, I'll get a powered USB3 hub. Hopefully the system will hang together long enough for me to resolve the issue.
A umount will generate that disconnect message - may not be h/w after all; have you checked cron/systemd.timers ?
I can't find cron/systemd.timers, I suspect it should be somewhere under /etc but can't find it. I have checked both my user and root crontabs and there's nothing to umount the USB drive. Can you help with the usual path to cron/systemd.timers?
Edited to add: {doh!} I guess you meant cron and/or the timers. I had a look at all the *.timer files I could find but didn't see something that might unmount the drive.
Thanks, Geoff
Last edited by Geoff_L; 06-29-2018 at 03:15 PM.
Reason: To clear up my misunderstanding
Just a SWAG but most WD external drives will spin down (I assume this is a not a SSD) after about 10 minutes of inactivity. It could be that the drive is not responding fast enough for the system when accessed at that particular time so it is disconnected and then a short time later responds but will be assigned a new device number.
WD external drives typically have a utility which can change the default settings but would assume they were deleted when you formatted the drive as ext4. You might be able to download the utility from their website. Another guess is that it could be a USB 3 driver problem with WDs power saving mode although I would of expected an increase in forum traffic on the same topic and I don't or just not looking in the right places. A number of years ago WDs external drives would enter power save mode and linux could not wake them back up again although they worked fine when connected to a Windows system.
Just a SWAG but most WD external drives will spin down (I assume this is a not a SSD) after about 10 minutes of inactivity. It could be that the drive is not responding fast enough for the system when accessed at that particular time so it is disconnected and then a short time later responds but will be assigned a new device number.[...]
Thanks for the suggestion.
I suspect that any drive would spin down in this context as it is normally explicitly accessed only during the backup procedure and so spends 20+ hours a day idle unless a background task accesses it.
I've switched USB ports to no avail but haven't yet taken the plunge to get a powered hub. However, I noticed that the device identification (New USB device strings: Mfr=0, Product=0, SerialNumber=0 in /var/log/messages) all are zeros. I suspect that any original values coded on the disk were wiped when I reformatted the drive to ext4 and I wonder whether the lack of non-zero values here might be the cause of the drive reconnecting with a new device number each time? I also wonder whether I can safely change these values (say, using gparted) and what these should be for a WD Passport drive? Can anyone shed light here?
You can easily write a udev rule that will give a fixed alias such as /dev/wd_passport which will always point to the device no matter the device number. You would just use /dev/wd_passport when referring to the drive. There are many good guides on how to write udev rules.
The serial number and other product information are stored in the drives electronics. You can not change these values. The drive could be failing or has power problems.
Possibly coincidence, but I noticed that the messages log also showed the Bluetooth/WiFi firmware was missing. I wasn't concerned about that because I don't use wireless with this machine (and I've turned both BT and WiFi off in the OS); but the messages were annoying and so I installed the required non-free firmware. Since doing that, the USB drive hasn't disconnected and I'm left scratching my head, wondering if there is a connection between wireless and USB.
Power draw would be a connection IMO. I was leaning towards usb cable TBH.
Most usb things that don't come with a wall wart I run through a powered hub. Although mostly to bring the ports closer to my chair / quality of the hub type thing. Plus a few historical instances of quirky devices that ONLY work when through a hub, even a un-powered one. But didn't work (reliably) when connected directly to the host port.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.