# USB 2.0 Hot-Swappable hd device

## amdxpraider

hi,

  I have an external case that can hold 4 3.5in hd's. It connects through one single USB 2.0 wire. All hds are NTFS. Also all get recognized through windows. I plugged in the usb wire to this gentoo 2.6.5 computer. dmesg showed nothing of it. Then I turned all 4 hds off and on again. It found scsi0-4 in dmesg. But when trying to mount I found i didn't compile ntfs support. so I went and added that. I did read only, not debug or write.  And I have modprobe with usb-storage and others and use the hotplug thing. 

So I restarted after recompiling the kernal, and now no matter what I do I can not get dmesg to sense the drives again. My digital camera storage which i connect iwth usb still works and detects fine. I still consider myself a beginner at linux and upkeeping my own linux box. I'm at the end of my knowledge for debugging this. I would appreciate any help and suggestions people have. Please be specific and include the commands I would need to execute. I believe if I can get the hds to show up in dmesg I can easily do the rest of the needed setup for mounting and sharing with other comps using samba. 

thanks!

  ~Brandon

ps: I'm not worried about how I'll need to handle actually hotswapping the hd's once they are mounted. I only have one hd that can't be in the case, and I won't be swapping hd's out all over the place  :Smile: . Just need to get em recognizedLast edited by amdxpraider on Sat Apr 23, 2005 6:53 pm; edited 2 times in total

----------

## Headrush

Do you have udev emerged and coldplug running.

```
rc-update add coldplug boot
```

----------

## amdxpraider

no, 

upon doing 'rc-update add coldplug boot'

reply -> " * /sbin/rc-update: /etc/init.d/coldplug not found; aborting."

----------

## fredgt

I just tried my enclosure on USB (normally i connect if by firewire) and it gets recognized as a SCSI disk.

what does this give: 

`fdisk -l /dev/scsi/host0/bus0/target0/lun0/disc` (edit this to get the correct drive if you have more than one SCSI device (sata, usbsticks))

or

`fdisk -l /dev/sda` (same here, edit to get the correct device)

also post you're

`cat /proc/diskstats`

----------

## fredgt

 *amdxpraider wrote:*   

> no, 
> 
> upon doing 'rc-update add coldplug boot'
> 
> reply -> " * /sbin/rc-update: /etc/init.d/coldplug not found; aborting."

 

You'll need to emerge coldplug first to get it working.

`emerge coldplug`

----------

## amdxpraider

under /dev/scsi I have host0 host1 host2 host3. None have anything deeper then target0.  So I get nothing

I unplugged all usb deviced except the one in question. If I plug in my usbstick for dig camera I get a sda1 device and I can mount fine. dmesg shows the dig camera one, unlike this usb hd tower. 

also for debugging I tried connecting a seperate more standard usb hd, a 160GB usb 2.0 western digital external drive. This one shows up in dmesg, and seemed to make sdb and sdb1 show up in /dev. However I could not get it to mount. That drive is also ntfs. The error was -> 

"mount: wrong fs type, bad option, bad superblock on /dev/sdb1, or too many mounted file" systems"

So I can't even get a standard usb external hd to work, but atleast that one is showing up in the dmesg.

'cat /proc/diskstats' gives

--------------------------

   1    0 ram0 0 0 0 0 0 0 0 0 0 0 0

   1    1 ram1 0 0 0 0 0 0 0 0 0 0 0

   1    2 ram2 0 0 0 0 0 0 0 0 0 0 0

   1    3 ram3 0 0 0 0 0 0 0 0 0 0 0

   1    4 ram4 0 0 0 0 0 0 0 0 0 0 0

   1    5 ram5 0 0 0 0 0 0 0 0 0 0 0

   1    6 ram6 0 0 0 0 0 0 0 0 0 0 0

   1    7 ram7 0 0 0 0 0 0 0 0 0 0 0

   1    8 ram8 0 0 0 0 0 0 0 0 0 0 0

   1    9 ram9 0 0 0 0 0 0 0 0 0 0 0

   1   10 ram10 0 0 0 0 0 0 0 0 0 0 0

   1   11 ram11 0 0 0 0 0 0 0 0 0 0 0

   1   12 ram12 0 0 0 0 0 0 0 0 0 0 0

   1   13 ram13 0 0 0 0 0 0 0 0 0 0 0

   1   14 ram14 0 0 0 0 0 0 0 0 0 0 0

   1   15 ram15 0 0 0 0 0 0 0 0 0 0 0

   7    0 loop0 0 0 0 0 0 0 0 0 0 0 0

   7    1 loop1 0 0 0 0 0 0 0 0 0 0 0

   7    2 loop2 0 0 0 0 0 0 0 0 0 0 0

   7    3 loop3 0 0 0 0 0 0 0 0 0 0 0

   7    4 loop4 0 0 0 0 0 0 0 0 0 0 0

   7    5 loop5 0 0 0 0 0 0 0 0 0 0 0

   7    6 loop6 0 0 0 0 0 0 0 0 0 0 0

   7    7 loop7 0 0 0 0 0 0 0 0 0 0 0

   3    0 hda 8470 610 313506 85613 1588 2176 30282 58576 0 45204 144189

   3    1 hda1 152 152 2 2

   3    2 hda2 1 8 0 0

   3    3 hda3 8861 312866 3785 30280

   3   64 hdb 0 0 0 0 0 0 0 0 0 0 0

----------------------

----------

## fredgt

when triing to mount the other usb drive did you do this manualy or with fstab.

try mounting it with "mount -t ntfs /dev/sdb1 /mnt/somedir"

The other drives don't seem to be recognised. What does `lsusb` when the drives are plugged in and are powered on.

also post the last part of dmesg when you just connected the usb-drives

----------

## amdxpraider

i tried to 'emerge coldplug'

I'm getting 

'!!! ARCH is not set... Are you missing the /etc/make.profile symlink?

!!! Is the symlink correct? Is your portage tree complete?'

I have the make.profile symlink. It links to ../usr/portage/profiles/default-x86-2004.0.

how can I know if my protage tree is complete? If it isn't, how could I correct this?

----------

## fredgt

emerge --sync will complete the portage and also update it.

----------

## amdxpraider

I was mounting the western digital 160 external drive with mount -t ntfs /dev/sdb1 /mnt/usbdrive

This is my dmesg when connecting the westernal digital drive

usb 4-2: new full speed USB device using address 7

scsi5 : SCSI emulation for USB Mass Storage devices

  Vendor: WD        Model: 1600BB External   Rev: 0411

  Type:   Direct-Access                      ANSI SCSI revision: 02

SCSI device sdb: 312581808 512-byte hdwr sectors (160042 MB)

sdb: assuming drive cache: write through

 /dev/scsi/host5/bus0/target0/lun0: p1

Attached scsi disk sdb at scsi5, channel 0, id 0, lun 0

Attached scsi generic sg0 at scsi5, channel 0, id 0, lun 0,  type 0

USB Mass Storage device found at 7

drivers/usb/input/hid-core.c: ctrl urb status -32 received

hiddev96: USB HID v1.10 Device [Western Digital External HDD] on usb-0000:00:10.2-2

as I mentioned before dmesg does not change when I connect the hd tower I initially posted about.

lsusb shows

Bus 004 Device 007: ID 1058:0401 Western Digital Technologies, Inc.

Bus 004 Device 001: ID 0000:0000

Bus 003 Device 001: ID 0000:0000

Bus 002 Device 002: ID 03f0:0904 Hewlett-Packard DeskJet 845c

Bus 002 Device 001: ID 0000:0000

Bus 001 Device 001: ID 0000:0000

that is with both the western digital usb external drive and the USB hard drive tower plugged in.

----------

## amdxpraider

ALSO.....     I'm doing an emerge --sync at the moment and will then do emerge coldswap when done.

----------

## amdxpraider

emerge --sync is done, and seemed successful, but I still get this message when trying emerge coldswap

!!! ARCH is not set... Are you missing the /etc/make.profile symlink?

!!! Is the symlink correct? Is your portage tree complete?

----------

## fredgt

Strage , it doesn't even show up in the lsusb. Do you have to power up the drives with a switch or are they powered on automaticly. Normally as soon something is plugged in you should see something in the lsusb. What USB drivers are loaded, UHCI , EHCI, OHCI?

----------

## fredgt

What lines are there in you're make.conf

There should be some lines like this. Normally these are the lines where you set you're architecture.

CFLAGS="-O2 -march=i686 -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

If you're system is not a i686 you'll need to change them.

For more info on the make.conf file see http://gentoo-wiki.com/MAN_make.conf_5

----------

## amdxpraider

in the hd tower there are 4 drives. There is a button that turns on the power supply for the case, and then there are indiv turn on keys for each drive so not all have to be on at once. I have them all on and I'm sure there is power to them all. I tested this by connecing the tower to a windows machine and the windows machine finds and can read all the drives fine

doing an lsmod gives me this below

Module                  Size  Used by

vfat                   11392  1

fat                    38592  1 vfat

nvidia               1700908  10

ohci_hcd               16644  0

via_rhine              17672  0

mii                     4096  1 via_rhine

snd_via82xx            21280  1

snd_ac97_codec         56324  1 snd_via82xx

gameport                3712  1 snd_via82xx

snd_mpu401_uart         5760  1 snd_via82xx

snd_rawmidi            19232  1 snd_mpu401_uart

usblp                  10880  0

uhci_hcd               28048  0

via_agp                 5760  1

agpgart                27432  2 via_agp

snd_pcm_oss            47780  0

snd_pcm                79496  2 snd_via82xx,snd_pcm_oss

snd_page_alloc          9092  2 snd_via82xx,snd_pcm

snd_mixer_oss          16384  2 snd_pcm_oss

snd_seq_oss            29312  0

snd_seq_midi_event      6144  1 snd_seq_oss

snd_seq                47632  4 snd_seq_oss,snd_seq_midi_event

snd_timer              20228  2 snd_pcm,snd_seq

snd_seq_device          6408  3 snd_rawmidi,snd_seq_oss,snd_seq

snd                    44388  12 snd_via82xx,snd_ac97_codec,snd_mpu401_uart,snd_rawmidi,snd_pcm_oss,snd_pcm,snd_mixer_oss,snd_seq_oss,snd_seq_midi_event,snd_seq,snd_timer,snd_seq_device

sbp2                   20872  0

ohci1394               29828  0

ieee1394               88756  2 sbp2,ohci1394

usb_storage            25856  1

hid                    30528  0

ehci_hcd               23428  0

usbcore                86236  8 ohci_hcd,usblp,uhci_hcd,usb_storage,hid,ehci_hcd

and if I understand correctly I use hotplug so these all come on at startup?

anyway i don't have to add them everytime. they always show up

----------

## amdxpraider

when I have my western digital external drive unplugged that usb_storage number is 0, and it's 1 when that's on. That number does not change when I try connecting the tower.

----------

## amdxpraider

i know there was one time my computer did see the tower. dmesg showed me that scsi0 though 4 were there, but at that time i didn't have scsi support and it didn't mount. Since the recompile of the kermal with scsi, I have not seen that info appear in dmesg. and I've tried every which way of connecting and powering the tower.

----------

## amdxpraider

heres what I got

CFLAGS="-O2 -mcpu=athlon-xp -march=athlon-xp -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

----------

## fredgt

Hotplug only works when the devices are plugged in after booting. It automaticly loads the correct driver and sets some other parameters and device permission. To have the same support for devices that are plugged in before booting you have to use coldplug. For the rest it does exactly the same.

But the problem is that you can't even see them with lsusb. I'm thinking the tower works with an internal usb-hub and that it doesn't work for some reason. Can you see what usb devices you have when you have it plugged in in windows.

----------

## amdxpraider

i looked into this, and this is how I think it's set up to the best of my ability. All the hd's are IDE. There must be a PCI->USB controller for each drive I'm assuming. I do see under windows->device manager, a pci to usb controller. also I see a usb mass storage device. in windows each drive is displayed as it's own hd. So the compter thinks 4 seperate decives are plugged in. so I'd guess there is a internal-usb hub also.

----------

## amdxpraider

maybe I need to include something in linux to help with the hardware that must be converting the ide drives to usb.

----------

## amdxpraider

I finally got the portage issue fixed....was a bad simlink. Found the new file and created a new make.profile simlink. Now I just emerge coldplug. Not sure if there's setup required after that though

----------

## amdxpraider

TOPIC CLOSED...

not sure exactly what happened, but the hotplug won't work if I have the power to the tower turned on when plugging in the usb cable. So it must be powered off when starting the pc, and also off when plugging in the usb cable, then i power it all on and seems to come up. I got coldplug installed. I hope that'll allow it to work on startup so I can automount the drives. 

fredgt I appreciate the help you gave. 

 ~Brandon

----------

