7. Basic verifications
In order to make sure that the device you look at and write on is the one intended, it is best to remove similar devices from the USB-bus before starting these procedures. |
7.1. A quick check
It is possible that your system is already set up for handling a USB-flash memory device. To check this, simply issue the command $ mount from an X-terminal. If something like
none on /proc/bus/usb type usbfs (rw) |
appears among the output, you are ready to go to Section 7.4 and proceed from there. It may be virtuous, however, to glance through the intervening sections. If the test is unsuccessful, all is not lost. Please read on.
7.2. Probing the /proc filesystem
A few things in the /proc directory can be checked so see if the kernel options have been properly included or the appropriate modules properly inserted. As a first check, see if the directory /proc/bus/usb exists. If it does, your kernel supports the USB-subsystem correctly. If this is not the case the kernel has to be re-compiled with appropriate USB support (see Section 5.2.3) or the kernel has to be updated. Next, check if the directory /proc/scsi exists. If it does, you're well-away. If it doesn't, SCSI support has not been compiled into your kernel (see Section 5.2.1).
In /proc there should be provision for a mount point for the USB filesystem. That point is /proc/bus/usb. If it exists, the kernel is correctly set up.
7.3. Mounting the USB filesystem
If the verifications of the previous sections were positive, the next step is to mount the USB filesystem. This is issued from root as follows:
# mount -t usbfs none /proc/bus/usb |
In older kernel versions the mount command above may have to be changed by replacing usbfs with usbdevfs. In Linux-2.4.20 both forms work. |
If there are no complaints, do some more tests. The first is the quick test (Section 7.1). A deeper probe would be to issue the command # ls -l /proc/bus/usb . This should give something similar to
dr-xr-xr-x 1 root root 0 Sep 19 14:21 001 dr-xr-xr-x 1 root root 0 Sep 19 14:21 002 -r--r--r-- 1 root root 0 Sep 19 22:30 devices -r--r--r-- 1 root root 0 Sep 19 22:30 drivers |
The path /proc/scsi/usb-storage-0/ should now exist and one of the files at the end will show this. In my setup the command $ less /proc/scsi/usb-storage-0/1 gives
Host scsi1: usb-storage Vendor: Generic Product: Mass Storage Device Serial Number: None Protocol: Transparent SCSI Transport: Bulk GUID: 0ed166800000000000000000 Attached: Yes/No |
If the flashdrive is present, the last line will have the entry "Yes". If it is not plugged in, the entry will be "No".
7.4. Tests -- vfat
You are now ready to find out if the memory stick is working. Let us suppose that you bought it over the counter. Its instruction leaflet will most likely tell you how to set it up for Windows. That is an indication that it is formatted in vfat. Before you try to mount it, create a mount point for it. Do something like # mkdir -m 777 /mnt/memstick. The mounting command would most likely be
# mount -t vfat /dev/sda1 /mnt/memstick |
If everything went smoothly, you should be able to see the device: # ls /mnt/memstick.
Now try some standard things like making a directory on the device and copying a favourite text file to it:
# mkdir /mnt/memstick/apollo # cp /home/myname/myfavourite_file /mnt/memstick/apollo/. |
List again (# ls -l /mnt/memstick ) and pay attention to the permissions.
Unmount the device (# umount /dev/sda1 ) and mount it again as above. List again and check the permissions. Most likely your favourite text file will now have an x-permission. It became executable. That is normal in the vfat filesystem. If you are happy with that, unmount the device and skip to Section 10 .