Koozali.org: home of the SME Server

USB hard drives

rickjones

USB hard drives
« on: March 02, 2004, 09:32:18 PM »
I'm having a few problems with external USB-2 hard drives on 6.0. I think these are essentially kernel issues, but I'd like to know if there are any work-rounds - any kernel experts out there?

The core of the problem seems to be that when a USB drive is unplugged, although the device is detached at the USB level, the SCSI device is not detached. So if, for example, you then plug in another drive of different size, the kernel thinks the drive geometry is still that of the original drive. You can see this by trying fdisk.

So although hot-swapping a drive basically works - i.e. you can access the data on the new drive - once the drive has been swapped things get a bit unstable, and eventually access to the drive is lost. The logs show that the USB driver has given up and in fact detached. The drive won't then reconnect without re-booting - total PITA :(

I suspect the issues are connected, and Ithink that both could be worked round if there was a way to force a SCSI device detach after unplugging the USB. I don't care if it's a manual operation (I have to unmount the drive manually anyway), but I don't know if this can be done from application level. Any suggestions?

It seems that later Linux kernels have cleaned up quite a few USB bugs, a lot are supposedly fixed in 2.4-22, just a pity SME is only 2.4-18. :-x  Although I started using these drives on 5.6, and I'm sure that version was more reliable than 6.0 with USB.

Any thoughts and ideas welcome.
TIA

Offline byte

  • *
  • 2,183
  • +2/-0
USB hard drives
« Reply #1 on: March 03, 2004, 11:00:20 AM »
Hi, you could try following this link which shows you how to upgrade your kernel, although still in beta, you could test this out on a test machine see how you get on...

http://vanhees.homeip.net/index.php?module=ContentExpress&func=display&ceid=18&meid=

HTH
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Anonymous

USB hard drives
« Reply #2 on: March 03, 2004, 01:27:47 PM »
Interesting - thanks!

I'd been wondering if a kernel update was feasible without clobbering the rest of SME, and virtually decided I'd rather live with the problem than spend the time trying it out :-)

However, as it seems to have been done already I may give it a go.

Cheers

rickjones

USB hard drives
« Reply #3 on: March 15, 2004, 06:08:24 PM »
Just following up on this ...

The kernel update didn't fix anything, and after much rummaging, including the linux-usb-users list at SourceForge, it seems to be an inherent problem.

The main issue is that you're not really supposed to swap drives within a single USB controller, because each USB device has a unique serial number. The kernel logs the serial, and associates it with a specific virtual-SCSI device. That said, there also seem to be problems with the USB drivers picking up the unique serial id properly, so swapping two USB devices of the same brand and model still might not work properly.

Apparently it's much better in 2.6 kernels, because hotplugging is supported for SCSI devices, which fixes it at a different level. I didn't fancy trying to plug a 2.6 kernel under SME though  :-)

As a provisional hack it can be worked round by rmmod'ing usb-storage after unplugging. Of course this only works when there are no more USB drives connected, but on my system I only have one most of the time. I've added this to the "remove" case in /etc/hotplug/usb.agent, so it happens automatically when the last drive is removed (you have to make sure to umount it first though).

Hope this helps anyone else who may be using USB drives.

Offline Reinhold

  • *
  • 517
  • +0/-0
    • http://127.0.0.1
USB hard drives
« Reply #4 on: March 15, 2004, 07:16:31 PM »
Just a few notes on what does work:

(1) Plugging&unpluging the same usb 30gig 2.5" drive on plain 6.x works here (... 3month uptime now).

(2) A Knoppix3.4 with Kernel 2.6 has no problems with exchanging 2 usb flashdrives or above mentioned 2.5" usb -drive in any combination (at least none in that area ;-))

FWIW
............