Skip to content

How to Mount a Network Share

Claude Pageau edited this page Dec 11, 2017 · 18 revisions

Introduction

This section will describe how to automatically save pi-timolo media files to a remote network share. You will need to have a writeable share setup on a remote computer or device.

Setup a mount point on RPI

Make sure you have the IP address of the network computer that has a share with read/write permissions. I am assuming this is a windows PC in the example. Change the items in bold to match the user login and share on the network computer. Note the windows user will need to have read and write permissions on the network share or you can set share access to Everyone read/write if you don't want a password.

Login to Raspberry pi via SSH or terminal session and perform the following. Note you can change the folder name mnt to anything you like.

cd ~/pi-timolo
mkdir mnt
sudo mount -t cifs -o username=loginname,password=password,uid=pi,gid=pi //serverIP/sharename ./mnt

This should mount the remote drive share to the /home/pi/pi-timolo/mnt folder. Check that the share is successful by typing ls mnt You should see the directory structure of the remote share if the share connected OK.

Setup fstab to Connect Mount Point on Boot

To make the change permanent put an entry at the end of the /etc/fstab file

sudo nano /etc/fstab

Add the following to the end of the fstab file

//serverIP/sharename /home/pi/pi-timolo/mnt cifs username=loginname,password=password 0 0

ctrl-x y to save changes

You should reboot and check to see if the network drive mounted OK.

Create Media Subfolders on Network Share

If it mounted OK then I would create a motion folder on the remote share

cd ~/pi-timolo
mkdir mnt/motion

Change config.py To Save Media to Mount Point Subfolder

Now just change the config.py file to point to the network share mount

cd~/pi-timolo
nano config.py

Change the appropriate motion or timelapse directory locations eg.

motionDir = "mnt/motion"

To Test Changes reboot the raspberry pi, then start pi-timolo.py and check that new files are being written to the remote network share.

Saving makevideo.sh Videos to Share Point

You can configure makevideo.sh to save timelapse video's to the remote share mount point. Edit the variables in makevideo.sh to enable this feature per variable comments. Use nano to make changes then ctrl-x y to save.

nano makevideo.conf

Change Variable settings per example below. Specify A valid network share mount point to copy video to then ctr-x y to save and exit nano

tl_share_copy_on=true 
tl_share_destination=$DIR/mnt  

IMPORTANT Make sure share is mounted or you will have files copied to the folder This will prevent mounting of share until the files in the folder are moved/deleted. Test changes to ensure everything is working.

Clone this wiki locally