Raspberry Pi – how to set up a hard drive to automount in fstab by uuid

  bash, linux, raspberry-pi
# be root
sudo su

# install utils
apt-get install ntfs-3g

root@pi2:/home/pi# blkid
 
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="7D5C-A285" TYPE="vfat"
/dev/mmcblk0p2: UUID="5d18be51-3217-4679-9c72-a54e0fc53d6b" TYPE="ext4"
/dev/sda1: LABEL="TinyTerra1" UUID="C642B17842B16E35" TYPE="ntfs"

 
# create mount dir
mkdir /mnt/d1

# edit fstab
nano /etc/fstab

# add:
# drive 1 terra
UUID="C642B17842B16E35"   /mnt/d1 ntfs    defaults,errors=remount,rw  0   1
 
# mount it
mount -a