LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-24-2008, 07:54 AM   #1
dkinfl
LQ Newbie
 
Registered: Jan 2007
Distribution: Fedora Core 6 on Dell Latitude D620 Laptop
Posts: 22

Rep: Reputation: 15
USB Hard Drive disconnects


We have 32 red hat linux 4 servers, each with western digital USB hard drives that have their own power supplies (NOT bus powered). The drives are only used nightly when a script runs to backup some data. Occasionally, on most of these servers, the drives "disconnect" and are missing from the /dev directory. The drives are mounted using the fstab, so a reboot of the server detects them and mounts them promptly. But, obviously a reboot is not a desirable thing.

Is there a command or something similar that will cause the server to re-detect the drive? I have only SSH access to the boxes. My thought is if there is such a command I could add it to my nightly backup script to correct a drive issue before the backup occurs.

Any info would be appreciated.

Thanks.
 
Old 12-24-2008, 08:42 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Maybe mount -a ?
See man mount
 
Old 12-24-2008, 08:54 AM   #3
dkinfl
LQ Newbie
 
Registered: Jan 2007
Distribution: Fedora Core 6 on Dell Latitude D620 Laptop
Posts: 22

Original Poster
Rep: Reputation: 15
That would work if the device was seen by the OS. I get the following:

[root@host ~]# mount -a
mount: special device /dev/sdb1 does not exist


It is like the USB drives are "sleeping" or some such thing causing the OS to not see them any more. I guess I need a way to tell Linux to rescan the USB ports to re-detect the drives. Unplugging and plugging back in the drive or rebooting the server causes the drive to be recognized, so I have to believe there is some kind of command available.
 
Old 12-24-2008, 09:20 AM   #4
rizwanrafique
Member
 
Registered: Jul 2006
Distribution: Debian, Ubuntu, openSUSE, CentOS
Posts: 147

Rep: Reputation: 19
I had similar issue with a USB hard drive recently. (to my understanding) what happens is that hard drive spins down (effectively goes to sleep???). I couldn't find any affective solution to solve that but got around it by writing a cron job that runs every minute and just touches a file in the hard drive. The shell script looks like:

Code:
#!/bin/bash
touch /media/my_book/.keephdactive
and cron job is:
Code:
 m h  dom mon dow   command
* * * * * /usr/bin/name_of_script
Another thing that I found useful was to mount the drive by its UUID. That provides solution of different drive name (sdc/sdd/sde etc).
 
Old 12-24-2008, 09:24 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
It is like the USB drives are "sleeping"
Ah.
Maybe they have powered down to save wear, tear & power. (But I am surprised that they have "disconnected" from the USB bus.)

This behaviour can be changed with hdparm (but only when the device is recognised as being connected)

When the drive is "sleeping", and not seen at /dev/sdb1 has it been mounted somewhere else (eg /dev/sdc1) ?

When the drive is "sleeping" is it seen by lsusb ?

Is there anything interesting in /var/log/messages when a drive goes to sleep ?
 
Old 12-24-2008, 11:30 AM   #6
dkinfl
LQ Newbie
 
Registered: Jan 2007
Distribution: Fedora Core 6 on Dell Latitude D620 Laptop
Posts: 22

Original Poster
Rep: Reputation: 15
the drive does not get remounted as any other device. /var/log/messages output below

Nov 30 15:07:23 host kernel: usb 1-6: USB disconnect, address 15
Nov 30 15:07:23 host kernel: scsi13 (0:0): rejecting I/O to dead device
Nov 30 15:07:23 host kernel: Buffer I/O error on device sdb1, logical block 1548
Nov 30 15:07:23 host kernel: lost page write due to I/O error on sdb1
Nov 30 15:07:23 host kernel: scsi13 (0:0): rejecting I/O to dead device
Nov 30 15:07:23 host kernel: Buffer I/O error on device sdb1, logical block 1548
Nov 30 15:07:23 host kernel: lost page write due to I/O error on sdb1
Nov 30 15:07:23 host kernel: scsi13 (0:0): rejecting I/O to dead device
Nov 30 15:07:23 host kernel: Buffer I/O error on device sdb1, logical block 1548
Nov 30 15:07:23 host kernel: lost page write due to I/O error on sdb1
Nov 30 15:07:23 host kernel: scsi13 (0:0): rejecting I/O to dead device
Nov 30 15:07:23 host kernel: Buffer I/O error on device sdb1, logical block 0
Nov 30 15:07:23 host kernel: lost page write due to I/O error on sdb1
Nov 30 15:07:24 host kernel: usb 1-6: new high speed USB device using address 16
Nov 30 15:07:24 host kernel: scsi14 : SCSI emulation for USB Mass Storage devices
Nov 30 15:07:29 host kernel: Vendor: WDC WD25 Model: 00BB-55RDA0 Rev: 20.0
Nov 30 15:07:29 host kernel: Type: Direct-Access ANSI SCSI revision: 02
Nov 30 15:07:29 host kernel: usb 1-6: control timeout on ep0in
Nov 30 15:07:29 host kernel: SCSI device sdb: 488397168 512-byte hdwr sectors (250059 MB)
Nov 30 15:07:29 host kernel: sdb: assuming drive cache: write through
Nov 30 15:07:29 host kernel: sdb: sdb1
Nov 30 15:07:29 host kernel: Attached scsi disk sdb at scsi14, channel 0, id 0, lun 0
Nov 30 15:07:29 host kernel: Attached scsi generic sg2 at scsi14, channel 0, id 0, lun 0, type 0
Nov 30 15:07:30 host scsi.agent[23366]: disk at /devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0/host14/target14:0:0/1
4:0:0:0
Nov 30 15:07:43 host kernel: usb 1-6: reset high speed USB device using address 16
Nov 30 15:10:06 host kernel: usb 1-6: USB disconnect, address 16
Nov 30 15:10:07 host kernel: usb 1-6: new high speed USB device using address 17
Nov 30 15:10:07 host kernel: scsi15 : SCSI emulation for USB Mass Storage devices
Nov 30 15:10:12 host kernel: usb 1-6: control timeout on ep0in
Nov 30 15:10:12 host kernel: Vendor: WDC WD25 Model: 00BB-55RDA0 Rev: 20.0
Nov 30 15:10:12 host kernel: Type: Direct-Access ANSI SCSI revision: 02
Nov 30 15:10:12 host kernel: SCSI device sdb: 488397168 512-byte hdwr sectors (250059 MB)
Nov 30 15:10:12 host kernel: sdb: assuming drive cache: write through
Nov 30 15:10:12 host kernel: sdb: sdb1
Nov 30 15:10:12 host kernel: Attached scsi disk sdb at scsi15, channel 0, id 0, lun 0
Nov 30 15:10:12 host kernel: Attached scsi generic sg2 at scsi15, channel 0, id 0, lun 0, type 0
Nov 30 15:10:12 host scsi.agent[23716]: disk at /devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0/host15/target15:0:0/1
5:0:0:0
Nov 30 15:10:26 host kernel: usb 1-6: reset high speed USB device using address 17
 
Old 12-24-2008, 12:19 PM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
Nov 30 15:07:23 host kernel: usb 1-6: USB disconnect, address 15
Nov 30 15:07:23 host kernel: scsi13 (0:0): rejecting I/O to dead device
Looks like the device disconnected and "died".
Quote:
Nov 30 15:10:12 host kernel: Attached scsi disk sdb at scsi15, channel 0, id 0, lun 0
And was then reattached 11 seconds later. Strange.

Did you get anywhere with hdparm ?

Look carefully at the -B and -S options.
 
Old 02-13-2009, 11:35 AM   #8
dkinfl
LQ Newbie
 
Registered: Jan 2007
Distribution: Fedora Core 6 on Dell Latitude D620 Laptop
Posts: 22

Original Poster
Rep: Reputation: 15
Solved!

I found the solution to this (at least for the Red Hat dirsto, 4 and 5). The hdparm command did not work on the disk since it was USB (at least that is my theory).

Instead, I made the following change, and so far no disconnects.

I modified the file /etc/modprobe.conf

I added this line to the end:
options usbcore autosuspend=-1

So far this seems to have worked. It has been implemented for two weeks and no HD disconnects. It does seem to require a reboot however to take effect.

Thanks for everyone's input on this.
 
Old 02-13-2009, 12:02 PM   #9
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Thanks for the follow-up with your solution.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Debian on USB Hard Drive/USB Jump Drive kushalkoolwal Debian 10 02-26-2009 01:46 PM
Copying files from internal Hard drive to USB 2.0 Hard Drive is NOT Behaving tubatodd Ubuntu 4 02-19-2007 04:32 PM
external enclosure for an internal hard drive vs external USB hard drive powah Linux - Hardware 1 03-10-2006 09:03 AM
Installing grub to external USB hard drive for later use as internal hard drive dhave Linux From Scratch 2 12-10-2005 08:48 AM
XS Drive II external USB hard drive/card reader max74 Linux - Hardware 7 10-21-2003 10:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 01:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration