-
Notifications
You must be signed in to change notification settings - Fork 102
How to mount external storage drive
How to mount external usb storage drives, devices, directory softlinks and more.
- Description
- How to Install usbmount
- How To Install Additional File System Support
- How To Configure usbmount
- Test usbmount
- How To Prepare A USB Storage Drive
- How to Create fstab entry
- How to Setup Directory Soft Link To Mount Point
Quite often you will need to save image/video 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
Note by default, mount points will be created in /media folder eg usb0, usb1 etc. When a usb storage device is inserted, it will mount at the next available mount point starting at usb0. Note default mountpoints can be changed by editing /etc/usbmount/usbmount.conf MOUNTPOINTS= variable
If you need NTFS and/or EXFAT file systems support then install the required 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
sudo nano /etc/usbmount/usbmount.conf
Edit usbmount configuration file similar to below. Note each file system is delimited by a space (no spaces for a specific file system) From an SSH or terminal session
sudo nano /etc/usbmount/usbmount.conf
Edit the following lines as required
ENABLED=1
FILESYSTEMS="vfat ntfs fuseblk ext2 ext3 ext4 hfsplus"
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 "
ctrl-x y to save changes
For additional usbmount configuration information see
https://raspberrypi.stackexchange.com/questions/41959/automount-various-usb-stick-file-systems-on-jessie-lite
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. Change parameters to suit your situation. Google if you need more detail.
/dev/sda1 /home/pi/mnt/hd_usb1 ext4 nofail,rw,defaults 0 0
/dev/sda1 /home/pi/mnt/hd_usb1 ntfs-3g nofail,uid=1000,gid=1000,umask=007 0 0
/dev/sda1 /home/pi/mnt/hd_usb1 vfat nofail,auto,user,rw,uid=pi,gid=pi 0 0
Test mount the drive per below and check if it mounts OK. fix any issues. Reboot to verify drive mounts on boot. nofail option will continue booting even if drive is not plugged in. This avoids problems with boot stopping and requiring manual intervention to fix.
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.