-
Notifications
You must be signed in to change notification settings - Fork 102
How to mount external storage drive
Quite often you will need to save image files to a NAS, external share or USB attached thumb or Hard Drive. This is important when you are saving a large number of images and/or videos. There is also added security since the system SD card can occasionally fail. This procedure assumes you are familiar with ssh, nano and a few unix command line commands.
sudo apt-get install usbmount
sudo nano /etc/usbmount/usbmount.conf
See https://raspberrypi.stackexchange.com/questions/41959/automount-various-usb-stick-file-systems-on-jessie-lite for details on configuring usbmount
If you need NTFS and/or EXFAT file systems install the support files per commands below. (note latest full jessie should already have ntfs and vfat libraries installed).
sudo apt-get install ntfs-3g
sudo apt-get install exfat-fuse
Edit usbmount configuration file and edit the FS_MOUNTOPTIONS= line to be similar to below. Note each file system is separated by a space (no spaces for a specific file system)
sudo nano /etc/usbmount/usbmount.conf
FS_MOUNTOPTIONS="-fstype=ntfs-3g,nls=utf8,umask=007,gid=46-fstype=fuseblk,nls=utf8,umask=007,gid=46 -fstype=vfat,gid=1000,uid=1000,umask=007 fstype=exfat,gid=100,uid=1000,umask=007"
Test usbmount
Insert a usb mass storage device. By default it will mount at /media/usb0-7 0-7 is a sequence number for each usb storage device plugged in. Test if you can write to the device. If not then edit the /etc/usbmount/usbmount.conf file
You can create links from pi-timolo to a one of the mount points per example below
cd ~/pi-timolo/media
ln -s /media/usb0 usb0
You do not need to change pi-timolo.py code. config.py will need to be edited to point to the drive mount point or a link to the mount point. I normally attach an external usb Hard drive, partition and formated with to ext4 file system using gparted.
sudo apt-get install gparted
This is a gui app so you will need to run from the pi desktop menu, tools. google for additional info on using gparted. You can also use a normal Fat32 formatted drive if you like. Once the drive is read you will need to create a file system mount point for the drive (empty folder). This can be in the /mnt folder but in my case I decided to put it in the /home/pi folder per example below
cd ~
mkdir mnt
mkdir mnt/hd_usb1
Now create an entry in the /etc/fstab to auto mount your new drive.
sudo nano /etc/fstab
Use nano to add a line in fstab file to mount your hard drive. In my case the line below. This will be different if you are using a fat32 formatted drive. Google if you need more detail sample fstab entry to mount ext4 formatted drive Modify as required
/dev/sda1 /home/pi/mnt/hd_usb1 ext4 rw,defaults 0 0
or sample fstab entry to mount fat32 formatted drive. Modify as required
/dev/sda1 /home/pi/mnt/hd_usb1 vfat auto,user,rw,uid=pi,gid=pi 0 0
mount the drive and check if it mounts OK. fix any issues.
mount /dev/sda1
cd ~/mnt/hd_usb1
mkdir data1
ls
Add a soft link to the relevant pi-timolo folder and created a link to the drive. Note change folder_name below to suit your needs.
cd ~/pi-timolo
ln -s /home/pi/mnt/hd_usb1/data1 folder_name
ls -a
Test to make sure the link works and you can write files to the hard drive link that points to the HD mount point. Please note you can change the mount point locations and folder names to suit your needs. Once the mount point is working you can change the pi-timolo config.py to point to the new folder_name folder soft link. Use nano to edit the config.py file and change the motionDir= and/or timelapseDir= entries to point to the appropriate folder link and folder name eg
motionDir=folder_name
This is just a sample guide. If you need more detail just google and you should be able to get more information on mounting storage devices to the raspbian file system.
- Wiki Home
- Introduction
- Prerequisites
- Install or Upgrade
- Run pi-timolo from a drive mnt
- Customize config.py
- Panoramic Images
- user_motion_code.py
- Align Camera Motion Area
- Schedule StartAt
- Basic Troubleshooting
- Tuning Variable Settings
- menubox.sh
- Web Server View Files
- Make Timelapse Video
- Join or Convert h264 to MP4
- Run on Boot
- Setup & Run shutdown.py
- Rclone Media Sync
- watch-app.sh Usage
- Plugins Usage
- Mount USB Storage
- Mount Network Share
- Auto SubFolder Creation
- Manage Disk Space
- Utilities Summary
- GitHub Repo
gdrive is no longer default.