raspberry pi

Mount a Network Share at Boot on your Raspberry PI 3

Tracking down information… is the hardest part of it.

I had an interesting time finding all of the commands that would work to mount a network share on my little linux box.

After a bit of trial and error, the steps needed to mount a network drive consist of first creating a mount point:

mkdir pictures

Then to mount the network drive against that location.  You first need to have a network share available.  I have a Synology Drive:


Synology Disk Station

These little boxes are AWESOME for a lot of reasons.  The main one for me is they provide a download and local store of all of my files on GoogleDrive… which is tremendous.  All of the family devices sync to Google’s Cloud, then this little drive downloads it to my local network.

All the convenience of the cloud – none of the risk of Google booting me for some random reason.

Additionally – I get to use the network drive to get access to my pictures for the PI Picture frame.

Anyway… back to the mount.  The Synology drive is at a locally reserved IP on my network.  So I can mount it like this:

sudo mount -t cifs -o username=<USERNAME>,password=<PASSWORD> //<RESERVED IP>/homes/admin/GoogleDrive /home/pi/pictures/

If that worked, then you can add an entry to your fstab, which will cause this drive to be ready to go every time the PI boots.

But first… remove the mount:

sudo umount /home/pi/pictures

Then, add a line to your fstab file, like this (I use vim, but nano is a good alternative):

vim /etc/fstab

And add the line (make sure to replace all of the <> entries with the right values, note also the path to the directories you might be after could be a little different.):

//<RESERVED IP>/homes/admin/GoogleDrive  /home/pi/pictures       cifs username=<USERNAME>,password=<PASSWORD>,nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=1  0

A good way to figure out what the mount directory should be is to first explore it using the network shares feature of Mac’s Finder or Window’s File Explorer.

Now… check to see if it works with:

mount -av

The “v” gives you the verbose output.  If it failed you’ll see:

mount: failed to parse mount options

If you were successful simply list the files in the mount:

ls /home/pi/pictures

If you see your stuff… Golden!  If not, double check the options in the fstab file to ensure you have all of the right details listed there.

Then reboot your pi.  If all goes well, it should be automatically mounted when the box comes back up.

Combine this with: Boot your PIXEL Based PI into Chromium Kiosk! and you can make a picture frame that has ALL of your photos.


One thought on “Mount a Network Share at Boot on your Raspberry PI 3

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s