How to automatically mount usb flash drive at startup

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
1

2 Answers

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.

2

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

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like