Doug's Linux Notebook

Using a USB Memory Stick (Thumb Drive) with Linux

NOTE: The recent distro releases will automatically mount USB devices when they are pluged into the computer. So this article is mostly obsolete, but may be useful to someone.

For Christmass 2003 my sister gave me a 128MB USB flash memory drive made by FujiFilm. I use it a lot, it's great for moving files from one computer too another. In Windows it shows up as a removable disk drive, and in Linux it can be mounted just like a floppy or CD drive or any other drive.

Your Linux system must have USB support, which most do in the newer versions. You may need to insmod the module for usb-storage

[doug@linux]$ su
Password: root-password
[root@linux]$ insmod usb-storage

Create a directory to mount it into (mount point), I named mine usb.

[root@linux]$ mkdir /mnt/usb

Linux sees the USB flash memory as an scsi drive so it would be dev/sda, assuming there are no other scsi devices. So it can be mounted as follows.

[root@linux]$ mount -t vfat /dev/sda1 /mnt/usb

Done this way only root will be able to use the device. To make things easyer and give normal users access add a new line to /etc/fstab something like this.

/dev/sda1     /mnt/usb     vfat     defaults,noauto,user     0 0

Now your flash drive can be mounted with the command

[root@linux]$ mount /mnt/usb

My hp digital camra is mounted the same way using the same mount point. I found that tring to use my camra after using the USB flash drive I got an error and it would not work untill I rebooted. This was because when I tried to mount the camra the computer was still tring to mount the flash drive at /dev/sda1, and the camra was at /dev/sdb1

To fix this I created a new mount point /mnt/usb2 and added another line to /etc/fstab.

/dev/sdb1     /mnt/usb2     vfat     defaults,noauto,user     0 0

Now I can mount the second device as /mnt/usb2 without any errors. I can even use both at the same time. There is probably a command to clear /dev/sda after removing the first device so that the second device can use /dev/sda but I don't know what that command is at this time.

Back to the Main Page