Re: usb external hard drive

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Dennis Kibbe
Date:  
To: plug-discuss
Subject: Re: usb external hard drive
On Fri, 22 Oct 2004 19:16:56 -0700 (PDT)
mike hoy <> wrote:

> Hi,
>
> I want to see the files on my external usb harddrive.
> on slackware 10.
>
> would also like to see my flash card.
>
> i believe they are both in vfat. i know the usb
> harddrive is vfat.
>
> Mike



And. . .

Are you just wishful thinking or actully looking for assistance, Mike? <g>

Here's how you do it. (NOTE: I talk about digital cameras ans Memory Sticks here, all usb drives (either flash or hard) work about the same.)

1. "/sbin/lsusb" will list what's on the USB bus. In the case of my Sony Vaio I get this:

Bus 003 Device 001: ID 0000:0000
Bus 003 Device 002: ID 054c:0056 Sony Corp.
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 001 Device 002: ID 046d:c00e Logitech, Inc. Optical Mouse
Bus 001 Device 003: ID 04a9:1050 Canon, Inc

The first is the Memory Stick socket, next is the mouse and the last is my printer, if the printer is turned on. This tells us that the system "sees" USB devices. To confirm the right modules are loaded run "/sbin/lsmod". Here's what I get:

usb-storage
printer
keybdev
mousedev
hid
usbmouse
input
uhci
usbcore

The modules you need loaded for USB to work are, of course, usbcore, uhci (or ohci, an alternate, I think) and usb-storage.

2. If the output of these commands look similar to mine, you should be ready to try mounting the device.

3. Let's make a mount point for the device using:

mkdir /mnt/ms

or if attaching your digital camera, it might be:

mkdir /mnt/cam

4. Now plug in (and turn on, if needed) the device

5. Run "dmesg" and you should see output something like this:

hub.c: new USB device 00:1d.1-1, assigned address 2
scsi2 : SCSI emulation for USB Mass Storage devices
  Vendor: Casio     Model: QV DigitalCamera  Rev: 5010
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sdb at scsi2, channel 0, id 0, lun 0
SCSI device sdb: 494080 512-byte hdwr sectors (253 MB)
sdb: Write Protect is off
 sdb: sdb1


Great! The device (here a camera) has been recognised *and* assigned the all important device name, sdb1. Without the sd<device a,b,c,d,etc.><partition 1,2,3,4,etc.> you can't continue.

6. We're in a hurry so let's hand mount the device for now by typing:

mount -t auto /dev/sdb1 /mnt/cam

now:

ls /mnt/cam

and you should see the contents of the flash card in the camera. First time out you're need to do this as root.

7. Now to unmount the device when we're done

umount /mnt/cam

Note: You won't be able to unmount if you cd'ed to /mnt/cam or a program is using a file on that directory, make sure to cd home before unmounting.

8. Now let's automate things by adding this line to /etc/fstab

/dev/sdb1        /mnt/cam      auto        noauto,user      0   0


"auto" lets the system try to guess the file format of the device and "noauto" tells the system that this is a removable device and not to try to mount it at boot. "user" allows an ordinary user to mount the device, otherwise only root can mount. You can use vfat as the file format if the device is fat32. That way long file names will be preserved.

The 2.4 kernel sometimes reassigned device names for usb devices (no persistant naming as in 2.6) so you can rerun dmesg if a device doesn't mount to see what's going on. Also, you can have more tha one entry in fstab to handle the situation. So in our example above if the camera sometimes shows up as sda1 just creat a second fstab entry like this:

/dev/sda1        /mnt/cam      auto        noauto,user      0   0


That system will be able to mount it either way.

Dennisk
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss