This program automatically mounts any usb drive you put in the pi to ‘/media/usb0’.
$ sudo apt-get install usbmount
First we need to find out where our system locates the device. With the USB device not plugged in, type…
$ tail -f /var/log/messages
Then plug in your USB device and, looking in the new lines which appear, make a note of the ID – it will be something like sda1, sdb1, sda2, sdb2 etc.
finding the ID of USB device Then CTRL-C To stop the tail command.
In this case the usb stick id is sda1. That means the device is located in /dev/sda1.
Next, we need to create a directory under /media, so you will be able to mount your drive.
$ sudo mkdir /media/usbstick usbstick can be whatever you want to call it
Then we mount the usb stick with…
If you are logged in as root…
$ mount -t vfat -o rw /dev/sda1 /media/usbstick/
…where sda1 is its id from the tail command and usbstick is the directory you just made.
If you are logged in as the default Raspberry Pi debian user, pi, you will need to use…
$ sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /media/usbstick/
…or you won’t get read/write access (the -o stands for options, uid is user id and gid is group id).
Then you can go there and have a look…
$ cd /media/usbstick $ ls -l
result of ls -l command …and you should get a listing of what’s on the USB stick you just mounted.
All Done? When you want to detach the stick, unmount it with…
$ sudo umount /media/usbstick
And then you can unplug it safely. If the umount command says the stick is in use, you may have to close any programs using the stick or, if the current directory is /media/usbstick, simply change it to another directory, then unmount the stick…
$ cd /home
That’s all there is to it.