Raspberry Pi – Formatting / mounting / “safe removal” of USB HDD

To list your file systems: (USB HDD will generally end up as /dev/sda1)

sudo fdisk -l
sudo mount -l
df -h

Format USB HDD to EXT4

Unmount the HDD first

sudo umount /dev/sda1

Format to EXT4

sudo mkfs.ext4 /dev/sda1 -L untitled


sudo mkdir /mnt/usbdrive
sudo mount /dev/sda1 /mnt/usbdrive
ls /mnt/usbdrive

Before disconnecting a USB drive

sudo umount /dev/sda1