This guide is intended mostly for my own reference, but I figured it can be of use to others as well.
/dev/sdxy
is the device/partition to mount/label/..., eg. /dev/sda
or /dev/sdb1
.
sudo blkid
returns a table like the following
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="37E2-62C3" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="467086ff-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="6a932c1f-7335-42d9-9351-1b1b2ca538d4" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="467086ff-02"
/dev/sda: LABEL="TIME_MACHINE" UUID="10f1b8d9-6166-4dee-9f6f-bf71aa56379a" BLOCK_SIZE="4096" TYPE="ext4"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/sdb: LABEL="DATA_SERVER" UUID="409c8a4c-0629-4fde-b049-82eff80fe308" BLOCK_SIZE="4096" TYPE="ext4"
Label makes it the easiest to reference. Label the harddrives/partitions properly.
fdisk -l
sudo fdisk /dev/sdx
sudo parted /dev/sdx
sudo mkfs.ext4 /dev/sdxy -v Label
sudo mkfs.hfsplus /dev/sdxy -v Label
(more involved, TODO)
Labeling the device/partition makes it easier to retrieve it, and by extension referencing it in /etc/fstab
sudo e2label /dev/sdxy "HDD_LABEL"
mkdir /mnt/mountpoint # by convention, mount stuff in /mnt.
mount /dev/sdxy /mnt/mountpoint
LABEL=HDD_LABEL /mnt/mountpoint ext4 defaults,noatime 0 2
Reference: fstab documentation