A few days ago I switched my HDD on my Raspberry Pi to a SSD drive. I use the Pi as a NAS serving files at home and I wanted to use a HDD for music with less storage but more reliability. This drive runs 24/7. I also chose exFat for the filesystem. I write this as a future self-reference, but may be useful for somebody else, so here it goes.
Find the drive
First you need to find the drive you want to mount. Run:
Which will list disk partitions in the system. In my case the interesting bit is:
And this one:
1 2 3 4
So note the location of the partition - in my example /dev/sda1.
Mount it manually
Test that you can mount it with mnt command:
If you then check the contents they should be visible:
If you have an exFat drive, mounting will not work, as you need a driver with support for it. On Debian and Raspbian, just install it with the package manager:
Mount it automatically
So you can mount and unmount the USB drive manually. But you can automate it even further so every time you start the Pi, it mounts the drive to the specified location. For this you need the UUID, not just the location, as it could potentially change.
Gives you a list of devices and their UUIDs. Note the one for your partition:
1 2 3
Then last step is to modify the file in /ect/fstab to mount your partition:
For the meaning of each value run the manual pages, but these are reasonable defaults for home drives.
Now every time the Pi starts it knows how to mount that drive. Also, if you run sudo mount -a command, it will also know how to mount it. Good for quick system maintenance.
EDIT 05/08/2016: I’m seen a lot of traffic coming to this post, so I wanted to give a heads up to anybody reading this: I’m no longer using ExFat for my Raspberry Pi. The reasons are in this post. If you want to try it yourself, you’re very welcome, and the steps are still valid AFAIK.