🌑

Linhost.info

Automatically Mount A USB Drive In Ubuntu Server

USB drives can be easily and automatically mounted on Ubuntu Server with the help of USBmount which is available from the Ubuntu and Debian repositories. Fortunately, USBmount requires little configuration in order to work. The following was tested in Debian 7 Wheezy and Ubuntu 13.04.

Installation and Configuration

Make sure you run apt-get update/upgrade before starting the tutorial.

1
2
3
sudo apt-get update

sudo apt-get upgrade

Now install USBmount from the repositories.

1
sudo apt-get install usbmount

USBmount mounts all USB drives in /media/usb*. Now plug a USB drive and wait for it to be detected and mounted. As long as the host OS supports the File System it should be mounted. To verify whether the USB drive was mounted correctly you can use df -h to view all available drives and their respective mount points. My 4GB USB drive is accessible from the /media/usb0 mount point.

1
2
3
4
5
6
7
8
9
10
11
user@debian:~$ df -h

Filesystem Size Used Avail Use% Mounted on
rootfs 49G 18G 29G 38% /
udev 10M 0 10M 0% /dev
tmpfs 100M 432K 100M 1% /run
/dev/disk/by-uuid/af874479-b4ee-4d83-a3da-d2fdb48511ea 49G 18G 29G 38% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 404M 0 404M 0% /run/shm
/dev/sdb1 138G 14G 118G 11% /media/hdd1
/dev/sdc1 3.8G 6.6M 3.8G 1% /media/usb0

To un-mount a drive you can use umount.

1
sudo umount /media/usb0

Conclusion

USBmount is quite handy for mounting USB drives with no effort.

, — Sep 24, 2013