USB Pen Drives: Large, Portable Storage in a Tiny Package - Page 2

By Carla Schroder | Posted Dec 22, 2003
Page 2 of 3   |  Back to Page 1
Print ArticleEmail Article
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn

Making It Work on Linux

On modern Linux distributions, it should Just Work. USB support first appeared in the 2.2 kernels, and hotplug support appeared in 2.4 (and has been backported as far as 2.2.18). But really, use a modern kernel — sheesh, it doesn't cost anything but a few minutes of your time to update it. And hotplugging is what really makes USB devices worth having.

If you have a reasonably modern Linux, chances are a fully-functioning hotplug subsystem is already in place, so all you need to do is plug in your kewl new pen drive and go to work. No need to mess with mounting and unmounting, which can be ever so tedious. Typically, the pen drives are factory-formatted in some form of FAT, which Linux handles just fine. Of course, you can partition and format it any way you like.

To find out what the file format is, use this command:

#fdisk -l /dev/sda

or whatever the drive designation is.

If you have other SCSI drives, it will be sdb or sdc or something similar. fdisk -l shows all mounted partitions. Linux mounts USB in the SCSI subsystem. Yes, it's fake SCSI, just like ide-scsi for CD writers.

To format a pen drive, or more precisely, to create a FAT32 filesystem:

# mkfs -t vfat /dev/sda1

To create a DOS filesystem:

# mkfs -t msdos /dev/sda1

etc., you know what to do.

Note that on a pen drive, it doesn't matter what filesystem you use. Use FAT32 or FAT16 if you want both Windows and Linux to read the files. You can use ext2, ext3, Reiser — any of them. (Please note that for devices like flash cards for cameras, you shouldn't monkey with the filesystem — you could render the card unreadable for the device.)

Page 3: The Hard Way

Comment and Contribute
(Maximum characters: 1200). You have
characters left.
Get the Latest Scoop with Enterprise Networking Planet Newsletter