Steps to manually mount a USB flash drive in GNU/Linux

I recently got hold of a 1 GB USB memory stick. It is a Kingmax 1 GB flash drive (U201G - U2GMHDWG) which is (believe it or not), half the size of my little finger. In fact, it is so small that there is a good chance I might misplace it somewhere if it was not tethered to a chain. Anyway, the USB stick has a FAT partition on it and contain some data which I wanted to access in GNU/Linux. I was using Ubuntu and it straight away detected the device as soon as I inserted it and it was automatically mounted in the /media/USB DISK location.

Kingmax 1 GB USB flash driveFig: The tiny 1 GB USB flash drive from Kingmax

But when I tried to mount it in a bare bones Linux distribution (a distribution which has just enough software as is needed), it was not mounted automatically. This is because the auto mounting takes place by means of a program known as hotplug which detects the USB device that is inserted in real time and then mounts it in the desired location.

So is it possible to mount a USB device (in my case the USB stick) manually ? Yes, it is possible. The idea is that the USB ports are detected by GNU/Linux as /dev/sdax - where 'x' in sdax stands for the number of the USB port. And once the USB device is connected to the USB port of your machine, you have to mount it manually.

These are the steps I followed to successfully mount the USB memory stick on my bare bones Debian Etch machine.
  1. Insert the USB stick into the USB port. My machine has 4 USB ports, 3 in the back and one at front. It doesn't matter which port you insert the device. The first USB port you use will be assigned the name /dev/sda1, the next port /dev/sda2 and so on.
  2. Check if the USB device is detected by GNU/Linux by running the following command:
    # lsusb
    Bus 002 Device 007: ID 0457:0151 Silicon Integrated Systems Corp. Super Flash 1GB Flash Drive
    Bus 002 Device 002: ID 8086:1120 Intel Corp.
    Bus 002 Device 001: ID 0000:0000
    Bus 001 Device 001: ID 0000:0000
    The first line in the output of the above command shows that the memory stick has been detected as Super Flash 1 GB Flash drive.
  3. Mount the device in the desired location. I chose to mount it in the /mnt/usbstick directory.
    # mount -t vfat -o rw,nosuid,nodev,quiet,shortname=mixed,uid=1001,gid=100,umask=077,iocharset=utf8 /dev/sda1 /mnt/usbstick
As an aside, you can do away with a lot of mount options such as nosuid, nodev and so on. The uid is necessary and is my user id number which allows me to access the device without being logged in as root. And if you are not sure of the partition on your usb stick, you can also use auto instead of vfat.

Update (19th March 2007): I forgot to mention one thing. The 'lsusb' command is used to find out if your USB device has indeed been detected by GNU/Linux kernel. If it is not detected by any chance because of non-availability of Linux drivers for your device, the command will not output the specific information. Once you are sure that the device has been detected, you can use the fdisk command to list the device(s) as follows :
# fdisk -l
which will list all the devices including the USB devices detected by GNU/Linux. Then you can use the mount command to mount it at a specific location.

 
 
 
 
Copyright © Sun solaris admin