The Raspberry Pi 2 (and 3) apparently has a problem with mounting USB drives at boot. This is probably due to the slow spin-up speed of HDD-based externals and the relatively fast boot of the Pi.
How to fix a Pi mounting error:
- Edit the Pi boot config:
sudo nano /boot/cmdline.txt
- Add this line:
rootdelay=5
- Change the root delay time from 5 to whatever option works for you (probably between 0 and 60 is best)
- Reboot:
sudo reboot
- Add this line:
- Edit the system boot config:
sudo nano /etc/rc.local
- Add these lines:
sleep 30 sudo mount -a exit
- Reboot:
sudo reboot
- Add these lines:
The second method worked for me.
When I connected my drives, I also had different functions and roles for them. The way they are now, I have a mirror of a data drive and a SnapRAIDed backup. So I needed to change the drive names in order to identify the drives.
How to change drive names in Linux:
- Identify the drives mount points:
sudo lsblk
orsudo mount
orsudo fstab -l
- Identify the drive names:
sudo lsblk
orsudo xfs_admin -l /dev/sdb1
- Unmount the drive:
sudo umount /dev/sda1
- Rename the drive:
sudo ntfslabel /dev/sda1 NAME
for NTFS orsudo xfs_admin -L NAME /dev/sda1
for XFS - Remount the drive:
sudo mount /dev/sda1
You must use the specific drive tool for the different file systems of drives. You cannot use an NTFS drive renaming tool on an ext4 drive, for example. See more at Source 2.