LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   USB Thumb Drive (https://www.linuxquestions.org/questions/linux-hardware-18/usb-thumb-drive-291014/)

WolfCub 02-16-2005 12:31 PM

USB Thumb Drive
 
How do I mount and read/write to a USB thumb drive? What do I need to add to /etc/fstab? Thanks.

mjrich 02-16-2005 02:40 PM

/etc/fstab:
Code:

/dev/sda1      /usbdrive      auto    rw,user,noauto  0      0
sda1 may need to be changed, depending on your hardware, but that should be a good start.

Cheers,

mj

WolfCub 02-16-2005 06:24 PM

I tried what you said. It didn't work. I get the error:

mount: you must specify the filesystem type
Please check that the disk is entered correctly.

I looked in /dev/ for sda1 and the device is non existant. I have a directory called /usb except it contains lp0 which I think is in use for my HP DeskJet printer. I have several USB ports on my ASUS A7N8X Deluxe. I am trying to use the front left port on my tower. Thanks.

mjrich 02-16-2005 07:14 PM

Unplug your USB thumbdrive, and then plug back it in. Now open a terminal, login as root, and then type
Code:

dmesg
The output should include something like the following:

sda: assuming Write Enabled
sda: assuming drive cache: write through
sda: sda1


This should tell you which device your usb drive has been plugged into. It may be within the subdirectory /dev/usb/foobar. If you know the filesystem already being used by the thumb drive (possibly Vfat) then you could change the first "auto" entry to "vfat", minus the quotes.

Cheers,

mj

WolfCub 02-17-2005 01:28 PM

OK, dmesg shows no "sda" stuff. Am I missing packages? Do I need anything? This is my fstab:

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda2 /mnt/hda2 reiserfs notail 0 1
/dev/hda3 /mnt/hda3 reiserfs notail 0 1
/dev/hda4 / reiserfs notail 0 1
/dev/hda1 none swap sw 0 0
/dev/hdc /media/cdrom0 iso9660 ro,user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
/dev/sda3 /media/usb vfat rw,user,noauto 0 0

WolfCub 02-17-2005 06:22 PM

This is the tail end of /var/log/messages:

Feb 17 07:21:27 localhost kernel: ohci_hcd 0000:00:02.1: wakeup
Feb 17 07:21:28 localhost kernel: usb 2-3: new low speed USB device using address 2
Feb 17 07:21:28 localhost kernel: usb 2-3: new low speed USB device using address 3
Feb 17 07:27:27 localhost kernel: Initializing USB Mass Storage driver...
Feb 17 07:27:27 localhost kernel: usbcore: registered new driver usb-storage
Feb 17 07:27:27 localhost kernel: USB Mass Storage support registered.


I think I may be missing modules. What ones do I need? I am using an ASUS A7N8X-Deluxe.

mjrich 02-17-2005 06:48 PM

Shouldn't do - from your /var/log/messages it looks like it should work. Are the messages about usb 2-3 from your printer, or from your thumbdrive ? Is this for your Debian or Slackware system ? You may also want to have a hunt around /dev/usb/*.

If this is the first time you have used your thumb drive with linux, you may possibly need to reformat it (use fdisk and mkfs).

Cheers,

mj

WolfCub 02-17-2005 07:19 PM

This is about my Debian system. I do not know if the messages are about my printer or the thumb drive, how do I check? I have information on the drive that I don't want to lose so I'd prefer to format it as a last resort. /dev/usb contains a file called lp0. Is lp0 of any use for the thumb drive? Please help me get this working, it contains documents I need to access as soon as possible...

I don't have Slackware anymore, but version 10.1 is catching my eye :)

mjrich 02-17-2005 07:54 PM

Easiest way (similar to dmesg) is to open a terminal, login as root, and run
Code:

tail -f /var/log/messages
and then plug your thumbdrive in. A bunch of messages should appear pretty much straight away.

If you have another thumbdrive around that you know works, it may be worth trying that also. If your drive is brand new, then it may have a filesystem that the kernel may not recognize (thus the suggested reformat of it) with OEM sectors that simply bugger it up.

Cheers,

mj

WolfCub 02-17-2005 09:12 PM

Upon doing what you said, the following new lines appear:

Feb 17 10:21:48 localhost kernel: ohci_hcd 0000:00:02.1: wakeup
Feb 17 10:21:48 localhost kernel: usb 2-3: new low speed USB device using address 2
Feb 17 10:21:49 localhost kernel: usb 2-3: new low speed USB device using address 3

What do I do next?

mjrich 02-17-2005 10:17 PM

Do you have any of sda, sdb, sdb1-4 etc. listed at /dev/ ? It is possible that this is where your thumbdrive is sitting.

Also, have a glance at http://www.linux-usb.org/USB-guide/x498.html. I have to dash for the moment (it is a hot, summery Friday afternoon, and drinks are a-calling), but good luck !

Cheers,

mj

WolfCub 02-18-2005 01:58 PM

I do not have any sda/sdb devices in /dev/. I have got to be missing drivers or modules or something? Could you tell me what modules are needed and how to find out which ones are installed? If you really want to I could give you my IP address and root password and you could ssh to my computer provided you don't screw anything up intentionally :)

mjrich 02-18-2005 04:50 PM

As far as I know, the modules you need are usbcore, usbserial, ehci_hcd, usb-storage (sometimes), and ohci_hcd (or usb_uhci/uhci_hcd). You can see which ones are up-and-running from (as root)
Code:

lsmod            or:
lsmod | grep usb

From your dmesg output though, it looks like everything should be ok (also given that your usb printer is working fine). You can use insmod <module> or modconf to insert new modules.

Another issue seems to be kernel versions - 2.6.7, 2.6.8.1 and 2.6.9 seem to have problems with usb thumbdrives. I'm running 2.6.4 and something else at work (2.4.* from memory). So if you have a stock debian kernel around, it may be worth switching back to that if you're using one of the > 2.6.6 kernels. If this is a recompiled kernel, you'll also need the SCSI modules, for usb to work.

Another option, is that you could boot up a copy of Knoppix, and use that to mount your thumbdrive (it should work fine there, and if it doesn't, then it almost certainly means that you'll need to format the thumbdrive using fdisk).

In this case, ssh-ing in probably wouldn't achieve a great deal (thanks for the offer though). If all else fails, I'd try Knoppix - it's hardware detection is pretty impressive.

Good luck :)

mj

WolfCub 02-18-2005 05:03 PM

I ran lsmod and got:

debian:~# lsmod
Module Size Used by
ipt_TCPMSS 4480 7
ipt_tcpmss 2304 7
iptable_filter 2880 1
ip_tables 18464 3 ipt_TCPMSS,ipt_tcpmss,iptable_filter
lp 11176 0
pppoe 14528 2
pppox 3720 1 pppoe
ipv6 264644 12
af_packet 22568 2
ppp_generic 30164 6 pppoe,pppox
slhc 7488 1 ppp_generic
pciehp 99020 0
shpchp 101900 0
pci_hotplug 34640 2 pciehp,shpchp
snd_intel8x0 36460 1
snd_ac97_codec 69988 1 snd_intel8x0
snd_pcm_oss 55080 0
snd_mixer_oss 20096 1 snd_pcm_oss
snd_pcm 98728 2 snd_intel8x0,snd_pcm_oss
snd_timer 25668 1 snd_pcm
snd_page_alloc 11752 2 snd_intel8x0,snd_pcm
snd_mpu401_uart 7968 1 snd_intel8x0
snd_rawmidi 25124 1 snd_mpu401_uart
snd_seq_device 8200 1 snd_rawmidi
snd 57156 11 snd_intel8x0,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer,snd_mpu401_uart,snd_rawmidi, snd_seq_device
soundcore 10336 1 snd
nvidia_agp 7804 1
mousedev 10476 2
tsdev 7392 0
usbhid 32224 0
analog 11968 0
gameport 4704 2 snd_intel8x0,analog
parport_pc 36900 1
parport 41800 2 lp,parport_pc
usblp 13088 0
floppy 61200 0
pcspkr 3592 0
rtc 12760 0
ehci_hcd 32004 0
ohci_hcd 21764 0
usbcore 119012 6 usbhid,usblp,ehci_hcd,ohci_hcd
eth1394 21576 0
sata_sil 8004 0
libata 41700 1 sata_sil
3c59x 39368 0
forcedeth 17984 0
ohci1394 35492 0
agpgart 34664 2 nvidia_agp
capability 4520 0
commoncap 7232 1 capability
evdev 9600 0
nvidia 3470236 12
sr_mod 17316 0
sbp2 24392 0
scsi_mod 125228 3 libata,sr_mod,sbp2
ieee1394 111512 3 eth1394,ohci1394,sbp2
psmouse 20360 0
ide_cd 42656 0
cdrom 40732 2 sr_mod,ide_cd
reiserfs 251024 3
ext2 71848 0
ext3 127240 0
jbd 62616 1 ext3
mbcache 9348 2 ext2,ext3
ide_generic 1408 0
ide_disk 19296 5
amd74xx 14620 1
ide_core 139940 4 ide_cd,ide_generic,ide_disk,amd74xx
unix 28756 367
font 8320 0
vesafb 6656 0
cfbcopyarea 3872 1 vesafb
cfbimgblt 3040 1 vesafb
cfbfillrect 3776 1 vesafb
debian:~#

I ran lsmod | grep usb and got:

debian:~# lsmod | grep usb
usbhid 32224 0
usblp 13088 0
usbcore 119012 6 usbhid,usblp,ehci_hcd,ohci_hcd
debian:~#


I am running kernel 2.6.8-2-686 off of the Sarge archives. Maybe I'm missing modules then?

mjrich 02-19-2005 03:25 PM

You could try inserting the usb_storage and scsi_mod modules into the kernel (insmod usb_storage etc.), however after reading through the bug reports for the 2.6.8-2 kernel at http://bugs.debian.org/cgi-bin/pkgre...ge-2.6.8-2-686, I'm beginning to think that you may be best off simply downloading an earlier kernel (one that supports SATA cards, presumably ?) from one of the Debian mirrors, or alternatively getting the very newest stable 2.6.10 from www.kernel.org. Most likely, the usb_storage module should have been loaded automatically when you inserted the card, but the fact that there are no /dev/sd* devices listed suggests something has gone pretty awry.

Sorry that I can't be much more help, but I'll be around on and off for the rest of the day if you need a hand.

Cheers,

mj


All times are GMT -5. The time now is 11:00 PM.