# USB Hard Drive

## ckwall

How do I get my USB hard drive to work under linux? What portions of the kernel do I need? How do I mount it? etc.

----------

## reverius42

 *ckwall wrote:*   

> How do I get my USB hard drive to work under linux? What portions of the kernel do I need? How do I mount it? etc.

 

Note that USB storage is mounted as a SCSI device in Linux, despite the fact that it's NOT SCSI. ::sigh::

You (probably) need to include "Prompt for Experimental/Unstable options" in the kernel config...

You need to include the following modules:

- Under USB: "usb-storage", and the module for your USB controller - either UHCI, UCHI Alternate, or OHCI. Try all of them.

- Under SCSI: "SCSI support", "SCSI generic", and "SCSI disk" should do it... possibly more. Include any module that looks like a generic scsi module.

I think that should do it for the modules, although I might be forgetting one.

Once all that is done, you should be able to mount the drive by doing "mount -t type /dev/scsi/... /mountpath". However, if you're like me, the partitions won't show up in /dev/scsi.

Mine didn't.

So, I read somewhere that you have to run "mknod something-or-other 8 1" or something to that effect. Probably "mknod /dev/sd0 8 1".

I haven't had a chance to try that, but if you're really lucky, the partitions will be visible in /dev/scsi and you'll be able to mount them.

----------

## ckwall

OK, Bring it down a level. I am very unfamiliar with alot of the kernel and where to find things.  But I was not able to find a single that that you refered to. 

Please be a little bit more descriptive and specific. I am very new to this.

----------

## reverius42

 *ckwall wrote:*   

> OK, Bring it down a level. I am very unfamiliar with alot of the kernel and where to find things.  But I was not able to find a single that that you refered to. 
> 
> Please be a little bit more descriptive and specific. I am very new to this.

 

Sorry  :Smile: 

Ok... wait a bit. When I'm home (and thus able to use a Gentoo box), I'll give you detailed and specific instructions. I just don't have a Gentoo box here, so what I wrote earlier was from my very foggy memory  :Wink: 

----------

## rommel

first do you have an ide cdrw working in gentoo? if so then you have the scsi part already enabled.

if not enable scsi disk scsi cdrom (while your in there) and scsi generic. i compile these into the kernel rather then modules

under usb you need to select support for usb, preliminary usb filesystem support then you can choose both uhci and ohci support depending on your hardware. last look for and enable usb mass storage support. 

now once you recompile your kernel you should be ready to see if your drive is seen.

you will have to mount it though so your going to have to make an entry to fstab to point to it. i just got a sandisk working in gentoo which grabs the first open scsi dev. i run 3 scsi hard drives so in my case the sandisk (usb smartcard reader) was mounted under sdd1.

so first create a mount point /mnt/flash then create an entry in fstab to point to it /dev/sdd1 /mnt/flash.(obviously you'll name them something different)

this is going to be a little different for a usb hard drive...i dont own one...but this should get you started. when you compile the kernel with the scsi and usb support reboot witht he new kernel adn the usb drive plugged in and look in /proc/scsi/usb-storage-0 to see whats there. if you see a file with a number on it type at the command line #cat /proc/scsi/usb-storage-0/3 for instance. this should list the device as it is seen by linux.

----------

## ckwall

I have tried all of the suggestions above and get  message that says someone reset chanel a when I plug in my usb hard drive.

----------

## ejwahl

I have an external USB hard drive working on my system.  "lsmod | grep usb" shows usb-storage and usb-ohci modules loaded.  Here's what I added to my /etc/devfsd.conf:

# Create /dev/sdb5 for the external USB drive

LOOKUP	^sdb5 CFUNCTION GLOBAL mksymlink scsi/host3/bus0/target0/lun0/part5 sdb5

REGISTER  ^scsi/host3/bus0/target0/lun0/part5 CFUNCTION GLOBAL mksymlink $devname sdb5

UNREGISTER ^scsi/host3/bus0/target0/lun0/part5 CFUNCTION GLOBAL unlink sdb5

I recommend plugging your HD in and rebooting.  Then "cat /proc/scsi/scsi" to see that it's recognized.  If you have no other external USB devices on your system, your HD will probably be either /dev/sda1 or /dev/sda5.  My HD is sdb5 because I also have an external USB ZIP.  Try "mount /dev/sda1(5) /mnt/whatever".  If all this works, then figure out what the symlink from /dev/sda1(5) points to.  That will give you the info you need to add the appropriate lines to /etc/devfsd.conf.

HTH,

----------

## jingo

 *reverius42 wrote:*   

> 
> 
> Once all that is done, you should be able to mount the drive by doing "mount -t type /dev/scsi/... /mountpath". However, if you're like me, the partitions won't show up in /dev/scsi.
> 
> Mine didn't.
> ...

 

I have the problem with my partitions not showing up. /proc/scsi/scsi shows my Maxtor hdd is correctly found!

How to use mknod again?? I can't seems to figure it out? Been having problems with my usb harddrive ever since switching to Gentoo (no probs under Redhat).

----------

## axses

Hello

Let me help you a bit here. If you only have one ext usb device, then it is safe to ignore the previous posts. You DO NOT need to edit devfsd  conf files.

In your kernel ---> usb support

 if usb 1 --> seletc (m) for UHCI or OHCI (m)

 if usb 2 ----> EHCI (m)

Also select (m) for usb mass storage

IN scsi options ---> scsi support (m) AND scsi disk support (m)

Recompile your kernel. There is no need to reboot as you have used modules in all cases as mentioned above. We are using linux and we do like to keep our uptimes high.

modprobe ehci-hcd

For me i use ehci (usb2) , but i have used the same technique for usb1.

dmesg usb addition

hcd.c: ehci-hcd @ 00:02.2, PCI device 10de:0068 (nVidia Corporation)

hcd.c: irq 3, pci mem f1c46000

usb.c: new USB bus registered, assigned bus number 1

ehci-hcd.c: USB 2.0 support enabled, EHCI rev 1. 0

## PLug in usb(2) device

hub.c: new USB device 00:02.2-1, assigned address 4

usb.c: USB device 4 (vend/prod 0xd49/0x5020) is not claimed by any active driver.

## this is where you load the storage mod

modprobe usb-storage

Initializing USB Mass Storage driver...

usb.c: registered new driver usb-storage

scsi1 : SCSI emulation for USB Mass Storage devices

  Vendor: Maxtor    Model: 5000DV v01.00.00  Rev: 0100

  Type:   Direct-Access                      ANSI SCSI revision: 02

WARNING: USB Mass Storage data integrity not assured

USB Mass Storage device found at 4

USB Mass Storage support registered.

# Now you still cant mount it anywhere, and this is where you load the sd_mod

Attached scsi disk sda at scsi1, channel 0, id 0, lun 0

SCSI device sda: 240119808 512-byte hdwr sectors (122941 MB)

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

## Now as long as you have the module loaded for the appropriate file ##system, you do NOT need to specify this in your mount command

## My ext hard drives are always fat32 (vfat)

root@axses drivers # modprobe vfat

root@axses drivers # mount /dev/sda1 /mnt/scsi

root@axses drivers # df -h /mnt/scsi

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda1             112G   91G   22G  82% /mnt/scsi

If you would like direct help, feel free to contact me and i will be glad to help you. I have been using gentoo since last year December only, but one of my first ambitions on any linux distro is to get external storage working.  Since i do not trust ide drives and ALWAYS mirror my work.

Here my email 

axses@axses.ch

Born free , Linux foreverLast edited by axses on Fri Jun 06, 2003 4:28 am; edited 1 time in total

----------

## axses

OH and about the post on " everything was working under redhat"

Most thigns do work under redhat, but what do you learn from just plugging in a hardware device and it works. For me that is what linux is about, a learning process. Since using gentoo I was able to write my comptia Linux + exam and pass it well, as one has to do thigns manually. Sure kde and gnome have some apps which makes sys admin easier. 

But thats just taking away the power from linux and command line. 

## Congratulations too all gentoo users that are working on the MAc OSX project. Its a brilliant idea and it will take the world by storm.

 :Smile:  Thx again for this amzing distro. I dont know where I would be without it.

----------

