Since Debian 8 is using systemd you might want to take a look at the current method to automatically mount devices on boot and as they get connected as well. While udev and fstab also work, they are the old way and not that easy to understand for beginners.
So here is how you automatically mount a device using systemd:
Find out the UUID of that device. Run
blkid /dev/sdXY
for that, where X is a letter a-z and Y is a (usually single digit) number. If you don't know what your device is, unplug it, run ls /dev/sd*
, then plug it in again and run ls /dev/sd*
again. Compare the two outputs and you will see that some sdXY has been added. X stands for the physical drive and Y for the partition. On a Raspberry Pi that would usually be sda1
.
Create a systemd mount service file with
sudo nano /lib/systemd/system/path-to-mountpoint.mount
I'm not sure about the file naming. But I read there is a convention that the file name is the path to the mountpoint with /
replaced by -
. I don't remember if it was mandatory. The content should look like this:
[Unit]
Description=My Happy-Place
[Mount]
What=/dev/disk/by-uuid/[YOUR UUID HERE]
Where=/path/to/mountpoint
[Install]
WantedBy=local-fs.target
Tell systemd that there is a new file by calling
sudo systemctl daemon-reload
Enable the new systemd rule by calling
sudo systemctl enable path-to-mountpoint.mount
That would be it. After a reboot your device will mount automatically. If you don't want to wait for a complete reboot you can start the service right away with
sudo systemctl start path-to-mountpoint.mount
and check the status of the service with
sudo systemctl status path-to-mountpoint.mount
To unmount your device you call the usual
sudo umount /path/to/mountpoint
Hopefully that is helpful and also other will start using the features of systemd. As Linux is very old now I know myself that there are plenty pages and tutorials that are not state of the art and some even outdated. So I try to fix that here for automatic mounting.
udev
rules; there should be examples and Q&A's about this on our larger sibling site, Unix & Linux. Note the type of filesystem is irrelevant to the automounting issue, and the automounting issue and the permissions issue are separate. It is easier to research them that way than look for something that is going to solve all your problems together.