To simplify the process of mounting a drive you can add the drive’s information to the fstab settings file located in /etc/.
(Recommend Ubuntu FSTAB community page for a deeper understanding of this file.)
First run nano to edit fstab. The -Bw options tell nano to backup the file and not to use any line-wrap.
sudo nano -Bw /etc/fstab
If you see some existing entries, do NOT change these, especially if there are entries to mount the SD card (/mnt/mmcblk0pX).
Add the following to the bottom of the file.
/dev/sda1 /mnt/usbdisk auto defaults,user 0 1
These are explained:
/dev/sda1 Is the location of the drive to mount.
/mnt/usbdisk Is the mount point, which is the folder to access the content of the drive.
auto Is the file system type, here you can set ‘auto‘ or force a file system type such as ext2, ext3, ext4, hfsplus, ntfs, vfat.
defaults,user Are mount options. You normally need to only supply ‘defaults‘. Though there are some others that maybe useful such as ‘ro‘ for read-only or ‘user‘ to enable write permission for all users. Use a non-spaced comma to separate multiple options.
0 A binary value used for debugging. It is best to keep this set at zero.
1 Pass number for a file system check at boot. ‘0‘ (zero) to disable or ‘2‘ to enable.
Save the changes to fstab. (Ctrl+x, Y)
The drive will mount at boot as long as it is attached to the Pi. If you want to mount the drive after you have plugged it in use mount with the automatic option.
sudo mount -a