Mount drive on boot
Date: July 8th 2016
Last updated: July 8th 2016
I am mounting a 16 GB USB drive to the head node which will eventually house the data directory of a MySQL database. This is generally not recommended because of the risks associated with loosing the data. However, I am doing this on a test platform so I don't mind if something goes wrong and I have to start from scratch (which will be downloading another sample database - no big deal).
Setup
- plug in the usb stick
- identify media (along with several other checks)
lsusb #check connected devices du -sh #total disk usage df -hT /home #check home disk usage df -h #check device summary free -h #check device memory w #who's using the system (cpu load) cat /proc/version #system version cat /proc/cpuinfo # cpu info lscpu #cpu info vcgencmd measure_temp #check core temp df --help # more info
- create mount location
mkdir /mnt/usb
- provide user permissions
sudo chown -R pi:pi /mnt/usb
- mount the drive
sudo mount /dev/sda1 /mnt/usb -o uid=pi, gid=pi
- To mount on boot, add this line to /etc/fstab
/dev/sda1 /mnt/usb auto defaults,user 0 1