For this post, we have an external hard drive connected to our Raspberry Pi which is at /dev/sda
. We can verify this by looking at the output of the command lsblk:
|
|
Lets create a mount point, which is the directory we’ll be able to access our external hard drive from. We’ve chosen the directory $ /mnt/mothership
, which we’ll create by running:
$ sudo mkdir /mnt/mothership
We’ll change the ownership from root, since we ran with sudo, to ourselves by running
$ sudo chown -R p: /mnt/mothership
Lets test out manually mounting the hard drive
$ sudo mount /dev/sda1 /mnt/mothership -o uid=pi,gid=pi
To verify it worked, lets list the contents of the directory
$ ls /mnt/mothership
We should see the output of our disk.
Now lets unmount, so we can setup the automatic mounting at boot.
$ umount /mnt/mothership
To automate the mounting on boot we’ll modify a file $ sudo vim /etc/fstab
adding the following as the last row in the file
|
|
Additionally we’ll install a package:
$ sudo apt-get install ntfs-3g
Which allows our NTFS disk drive to be read and written to from the Pi.
To have your fstab file to run without rebooting run $ sudo mount -a
Now your disk should mount to /mnt/mothership
automatically on boot!