Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

USB hard drive not working properly

Need help with peripherals or devices?
Post Reply
Message
Author
Dr. Moose
Posts: 2
Joined: 2005-07-05 21:07

USB hard drive not working properly

#1 Post by Dr. Moose »

I've been using Debian for a while now with very little difficulty, however there has been one recurring problem I haven't been able to work around.

I have two different models of USB hard drive, but neither seems to work properly under Linux. They both show exactly the same symptoms.

I only use one at a time, and both of them end up being /dev/sde. Here's the line in my fstab:

Code: Select all

/dev/sde1       /media/usbhd     vfat    rw,user,noauto  0       0
I mount as myself from the terminal, and seems to work flawlessly. After a few minutes of use, whatever application or applications I have using the drive freezes.

Trying to kill the now-frozen program doesn't work, and the only way to correct the problem is to unplug the drive.

During the freeze, running dmesg results in a whole stream of messages like the one below, but with different sector and block numbers.

Code: Select all

SCSI error : <2 0 0 0> return code = 0x70000
end_request: I/O error, dev sde, sector 267154378
Buffer I/O error on device sde1, logical block 267154315
I have no devices that are actually SCSI. The USB drives get /dev/sde instead of one of the earlier slots because I have an internal USB device that can read 5 types of flash cards. Incidentally, this device can run mounted for hours of constant use (my music is on an SD card) without issue.

The problem occurs on kernels 2.4, 2.6.8, and 2.6.10. The 2.6.10 kernel I have is one I compiled myself from Debian's source packages (which I did not alter in any way). The others were stock Debian kernels.

The drives are a Medion MD 9001 200GB U-ATA 100 drive, and a Maxtor 120GB OneTouch drive. The Medion is USB 2.0 capable, but I don't have a USB 2.0 port.

Anyone know what I need to do to fix this?

Thanks.
Dr. Moose

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#2 Post by lacek »

I have USB HDD myself, and I had a hard time getting it to work (I have my system running from it).
I don't really know much about USB, its physical layout and so on, but it seems that USB HDDs under Linux are tend to fail because of some sort of power shortage. It seems that the USB port's limited power is simply not enough to power the drives under heavy load. When the power fails, the drive gots disconnected from the USB port and all processes which was using it, get a "D" flag, which means they are uninterruptable because they are waiting for I/O.
It may worth to mention that my drive(s) never failed with only USB1. They failed only when the ehci (USB2) driver was used.

Here a few workarounds you may try:
- Try to feed your drive from an external power source (if it is capable of
getting power from outside), but be warned: you should pay keen
attention to the power supply, the supplied power, and the polarity
of the power cable. I fried an external case this way... :-)
- Try setting max_sectors to 32, thus artifically "slowing" the drive down.
To do this, mount sysfs, and do this:
echo "32" > /sys/block/sde/device/max_sectors
- Try to remove the ehci driver if you don't need it anyway.

I finally got my drive working by tweaking in sysfs, and playing with the arguments of the ehci-hcd module. It works now, but by far it is not perfect. I'd be glad if someone could give a more specific answer on this topic than my one was...

If your drive(s) already use(s) external power source, then the above text means "I have no idea..." :-)

Dr. Moose
Posts: 2
Joined: 2005-07-05 21:07

#3 Post by Dr. Moose »

The drive did use external power, but

Code: Select all

echo "32" > /sys/block/sde/device/max_sectors
seems to have fixed it.

Thanks.

Am I going to need to do this before I mount every time, or will it stay that way?
=-=-=-=-=-=-=-=-=-=-=-=
2.6.10-1-686 kernel
512 MB RAM
nVidia GeForce4 videocard
alsa, dmix, esd, arts, oss emulation
gnome

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#4 Post by lacek »

You need to do this on every mount. Actually, you need to do this every time you plug your drive in, because the sysfs entries are not remembered any way.
You may want to add a custom hotplug script to handle this automatically. If you already have a hotplug script (/proc/sys/kernel/hotplug contains a valid executable target), then only the manual way remains...

Post Reply