TAGS: usb, mount, raspberrypi
Add a USB drive to a Raspberry Pi that is mounted on start-up.
lsblk
blkid /dev/sda1
sudo mkdir /mnt/data1
sudo chmod 400 /mnt/data1
ls -ld /mnt/data1
sudo mount /dev/sda1 /mnt/data1
sudo chmod 777 /mnt/data1
ls -ld /mnt/data1
touch /mnt/data1/test.txt
ls -l /mnt/data1/
Add the following line to /etc/fstab, replacing the UUID with the correct value found in step 4:
UUID=dc55cf20-4d5f-460a-991b-424a03934905 /mnt/data1 ext4 defaults,nofail,noatime 0 2
You can try to reboot your Raspberry Pi at this point, and it is very possible that your USB drive does not mount. This can be caused by the Raspberry Pi trying to mount the drive when the USB drive is not ready. We can solve this by putting a boot delay in.
Edit /boot/cmdline.txt and at the end of the line, append this text:
rootdelay=10
This causes a 10 second delay before booting, giving the USB drive time to power up and initialize.