Follow by Email

Blog Archive

Search This Blog

Automatically mount / unmount USB stick using usbmount

Automatically mount / unmount USB stick using usbmount
Share it:
Automatically mount / unmount USB stick with "usbmount"

A computer is not good enough if you can not extend it to storage. Raspberry Pi is best suited for USB sticks. However, those under Raspbian Wheezy are not automatically included, such as on Windows, Mac OS or other Linux systems. Therefore, the possibility should be established that USB sticks are automatically integrated and that also files can be stored on it.
Task
  • Set up the possibility that USB sticks are automatically "mounted" when plugged in.
  • Make sure that you can also save files to the USB stick.
Solution: Automatically mount / mount USB sticks (Raspbian Wheezy)
It is about a USB stick to "mount" automatically. This means "embed" or "mount" so that you can access it via the directory system. To do this, we install the software "usbmount", which is specially designed to "automatically mount" USB sticks.
sudo apt-get install usbmount

After installation, a directory named "media" is created in the root directory. In it are further directories with the names "usb0" to "usb7", as well as a link with the name "usb", which points to "usb0". If a USB stick is now plugged in, it is automatically mounted.

Unfortunately, one can not write to the USB sticks as a normal user. For this you have to configure a little something. To do this, open the following file.
sudo nano /etc/usbmount/usbmount.conf
Here you look for the following option:
FS_MOUNTOPTIONS = ""
and change it into
FS_MOUNTOPTIONS = "- fstype = vfat, gid = users, dmask = 0007, fmask = 0117"
Then save the file: Ctrl + O, Enter, Ctrl + X. Then reboot the system:
sudo reboot
Then you have access as a user writing on the inserted USB sticks.

To test, insert a USB stick, create and save the following file.
nano /media/usb/test.txt
Show if the file really exists:
cd / media / usb
ls
Then you can delete the file:
rm test.txt
Share it:

Raspberry Pi

Post A Comment:

0 comments: