How to Locate a Flash Drive in Unix
Depending on your version of Unix or Linux, flash drives may not be automatically identified and mounted by the system. Discovering the device id of the drive so that it can be mounted manually can be a difficult problem. However, there is a fairly simple technique for quickly finding the flash device on your system and mounting it.
Instructions
-
-
1
Disconnect your flash drive from the computer.
-
2
Open a terminal window. You're going to use a simple Unix command called "tail" to have a running copy of the system message log printed to this terminal.
-
-
3
Run the following command:
tail -f /var/log/messages
The application tail, run without any flags, will simply print out the tail end of whatever file is given to it--usually the last dozen lines or so. However, with the "-f" modifier, it becomes a very powerful command: it watches the file and immediately updates your terminal with any lines that are added to it.
-
4
Plug in your flash drive and watch the terminal that is running tail to see what is logged. You will most likely receive a fair bit of new information in the log, but you are watching for a few lines that look something like this:
sdb: sdb1
[sdb] Attached SCSI removable disk.In this case, sdb1 is the device name that has been assigned to the flash drive, though it may be slightly different on your system. All that remains is to mount the drive so you can use it.
-
5
Mount the flash drive. To do so, run the following command:
sudo mount -t vfat /dev/sdb1 /media/usbdrive/
Going command by command, "sudo" is used to claim root privileges. You may or may not need this command depending on your system's setup and the privileges associated with your user. "Mount" is the command for attaching a new device to the file system. The arguments "-t vfat" tell the computer what file system to use, in this case either FAT16 or FAT32. The path "/dev/sdb1" is the device name of your flash drive, and should be changed to reflect the device name that you discovered in steps two to four. Finally, "/media/usbdrive/" is the folder where the drive will be mounted. Any folder on your file system can be used here, with a few limitations. First, for obvious reasons, you will want the folder to be empty before you mount another device to it. Second, the folder must exist before you run the mount command, otherwise the operation will fail. You can create the folder using the mkdir command, like this:
mkdir /media/usbdrive/
-
1
Tips & Warnings
It's possible, depending on your version of Unix or Linux, that the system messages log will be located in a different location. If you cannot find the system messages log, consult your documentation to discover its location.