Ubuntu – Automatically mounting USB drives on boot

automountusb-drive

I have a Plex media server installed on Ubuntu 14.04, which use two external hard drives (/dev/sdb1 and /dev/sdc1). I would like to automatically mount these at boot to /media/drive1 and /media/drive2 respectively. Is there any way I can do this in Ubuntu?

Best Answer

You can try editing the fstab file. Here is how to access it: nano /etc/fstab. On nano, you can use any editor install in your system, like Vi/Vim. The file will have headings which are self explanatory. It will have Mount point-Where you can the drive to be mounted, e.g /home/media. It will also have Type(File system type, e.g ext4) and others. Once you finish adding your drive(s) there, the drive will automatically be mapping itself there once plugged in.

Here is my edited answer

  1. Check the files system of your drives by running df -T. For example you will see something like this

  Filesystem      Type     1K-blocks      Used   Available   Mounted on
  /dev/sdb1       ext4       10240        0       10240       /home

2. See the help provided in this post if you have problems with file systems.


  1. Edit the fstab like this:

   #Device         #Mountpoint  #fs-type     #options     #dump  #fsck
 /dev/sdb1       /media/drive1    ext4        defaults      0      0
 /dev/sdc1       /media/drive2    ext4        defaults      0      0

You may find nothing configured in the fstab file but it's likely that the default boot drive is configured there. Go ahead and just edit the file exactly as I have shown in step 3.

Related Question