31

I need to mount usb flash drive to automatically during OS startup also tried

mount /dev/sdb2 /media 

but after rebooting not able to see mounted drive please suggest.

lsusb
Bus 001 Device 003: ID 0411:00a2 BUFFALO INC. (formerly MelCo., Inc.)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

df -h
/dev/sda1
/dev/sdb2
hg8
  • 13,462
Ramesh Chand
  • 7,274
  • 4
  • 33
  • 37

2 Answers2

39

Edit your fstab via

sudo nano /etc/fstab

and add the line below

UUID=0e281f8d-1117-451d-9b1b-b07405a631bc /media auto nosuid,nodev,nofail 0 0

Replace the UUID in my example above with the UUID of your partition

sudo blkid /dev/sdb2 | awk -F'"' '{print $2}'

Note, the entry in your fstab doesn't mount the drive if it's not present during startup.

A.B.
  • 90,397
19

You can use Ubuntu Disks utility. Open the Dash and search for Disks.

Select your USB key in the menu on the left, click the gears and select Edit Mount options :

enter image description here

From here simply check : Mount at startup :

enter image description here

hg8
  • 13,462