[H-GEN] using a USB thumbrive with Linux

Tony Nugent tony at linuxworks.com.au
Fri Sep 26 18:24:41 EDT 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

On Sat Sep 27 2003 at 00:01, David wrote:

> I have access to a 512M JetFlash USB thumbdrive that I'd like to use with
> Linux. I've never tried to do anything like this before on Linux.

Yep, those things are _very_ cool.  I'm not familiar with that
particular brand, but I've used several and all of them have "just
worked" (courtesy of hotplug).   I use them to cart around all sorts
of data (like patches and updates for linux and windoze boxes), and
many cdrom-based distros are coming with the ability to use them for
boot-time customisations and as /home partitions.

> I did modprobe usb-storage as suggested by a website that I found (brave
> person that I am...) but I'm wondering if because this has been formatted on
> a Windows box (and I can r/w it on my Windows box) it's unsuitable for Linux.

No, if linux can read the filesystem on the drive, then this is
(largely) irrelevant.  (It might be a problem to r/w with ntfs).

Check /var/log/messages to see what hotplug is trigged to do when
you attach the flash drive.  The usbcore and usb-uhci drivers should
load, followed by usb-storage and then sd_mod (see the output of
"lsmod").  If they don't load automatically, then do it manually
with modprobe.  The flash drive then becomes an emulated scsi drive,
accessed via /dev/sdXX.  For example:

 kernel: Initializing USB Mass Storage driver...
 kernel: usb.c: registered new driver usb-storage
 kernel: scsi1 : SCSI emulation for USB Mass Storage devices
 kernel:   Vendor: 3SYSTEM   Model: USB FLASH DISK    Rev: 1.00
 kernel:   Type:   Direct-Access                      ANSI SCSI revision: 02
 kernel: USB Mass Storage support registered.
 kernel: Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0
 kernel: sr0: scsi3-mmc drive: 52x/52x writer cd/rw xa/form2 cdda tray
 kernel: Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0
 kernel: SCSI device sda: 1024000 512-byte hdwr sectors (524 MB)
 kernel: sda: Write Protect is off
 kernel:  sda: sda1

Now do "fdisk -l /dev/sda" to check ifsee how the flash drive is
partitioned.  If it has a fat partition on it then you'll be able
to mount it:
	mkdir /mnt/flash
	mount -t vfat /dev/sda1 /mnt/flash

The fat/vfat/nls_* modules will load, and you should be able to read
and write to it.  Works for me :)   You might want to create an
fstab entry to make it easy to mount it:

/dev/sda1 /mnt/flash auto defaults 0 0

If it isn't partitioned and/or formatted (or you want to repartition
it), then use fdisk and any of the mkfs.* utilities on it to make it
useable.  Unless you are using it for knoppix or lindows or
whatever, I recommend vfat to make it useable with both linux and
windows.

> Any suggestions/advice appreciated, and if I should be undoing the above
> command somehow, please tell me how.  ;-)

You must be oh so close to having it work... good luck.

> thanks a lot
> David

Cheers
Tony

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list