In this example, we are using a single drive with the following details apply:
- Mount point:
/media/PiDriveOne
- Share Point:
/media/PiDriveOne/shares
- Device Path:
/dev/sda1
- User account:
stord
Make a directory that will be our mount point
![Raspberry pi fstab mount on boot Raspberry pi fstab mount on boot](/uploads/1/2/5/1/125134998/951705648.png)
To 'mount' a network storage folder on your Raspberry Pi, you must first create a folder onto which you will 'mount' the external network drive. This is the location on your Raspberry Pi where you will find all the files from your network storage. For example, go to your home folder and create a new folder with.
sudo mkdir /media/PiDriveOne
Get the path to our disk(s)
sudo fdisk -l # /dev/sda1
Check if our drive is already mounted by another process
Unmount our drive
sudo umount -v /dev/sda1
Mount our drive to the mount point (created above)
sudo mount -t auto /dev/sda1 /media/PiDriveOne
Create a sub-directory which is to be used as our network share
sudo mkdir /media/PiDriveOne/shares
Install samba and back up the original config file
Create a share inside our samba config file
sudo vim /etc/samba/smb.conf
Restart samba
sudo /etc/init.d/samba restart
Create a user as part of the users group
sudo useradd stord -m -G users
Give our new user a password
sudo passwd stord
Tell samba about our new user and password
This step is very important:
sudo smbpasswd -a stord
Testing
Go onto our windows and/or osx system and try to create a file and edit it.
- windows command below (or use explorer instead):
SERVERNAMESHARE
- mac osx, Finder > Go > Connect to Server or CMD-K
smb://IPADDRESS/
Make your drive mount at boot time
sudo vim /etc/fstab
/dev/sda1 /media/PiDriveOne auto noatime 0 0
The next time you reboot, the drive should auto mount.