Skip to content

How to Mount a Network Share

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

Manage Archiving and Sending Media to Network Storage Devices

Description

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. It is recommended that you manually configure a fixed IP address since a router may change a DHCP IP address when lease is renewed.

How to Mount Point a Network Share

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 automatically connect the network share on boot (make change permanent) you need to 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. Note If you are using a plugin you may need to check the appropriate plugin file for a destination folder and change it to point to the remote share mount point.

Saving Video Files to Share Point

pi-timolo Camera video files need to be converted from h264 format to mp4. This is done using makevideo.sh and will take some time depending on the size of the video. This means you need to configure makevideo.sh to save to a network share. You can configure makevideo.sh to save timelapse video's to the remote share mount point by changing the makevideo.conf file. Edit the variables in makevideo.conf file to enable this feature per variable comments. Use nano to make changes .

nano makevideo.conf

Change Variable settings per example below. Specify A valid network share mount point to copy video to.

tl_share_copy_on=true 
tl_share_destination=$DIR/mnt  

Press ctrl-x y to Save changes and exit.

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