Mount External Harddrive on Raspberry Pi

Objectives

Partition, format and mount a large harddrive to RPi 4 to available USB 3 port.

Introduction

This drive will be used as a NAS for movies, pictures, data. There are lots of tutorials on how to do this.  I will just run through the steps quickly.

Requirements

  • Raspberry Pi 4
  • External harddrive
  • Enclosure with its own power supply

Recipe

Mounting

  1. Attach drive. Insert HDD into enclosure; plug in drive into wall; plug in drive to USB 3.0 port (lower) on RPi4.
  2. Confirm connection.  Use sudo fdisk -l to list drives. Your drive will likely show up at the bottom of the list.
  3. Partition the drive.  Assuming the drive was attached at /dev/sdb, use parted /dev/sdb.
  4. Then mklabel gpt which is needed if drive is more than 2gb
  5. Then mkpart primary ext4 0 2.7tb [change size of drive, i.e., 2.7tb to whatever you have]
  6. Quit
  7. Format the drive. Use: sudo mkfs.ext4 /dev/sdb1
  8. Create a mount location.  Use sudo mkdir /mnt/hdd
  9. Mount the drive. Use sudo mount /dev/sdb1 /mnt/hdd

The drive is not mounted on your RPi if all went well.  You can now type df -h and get a list of drives and you should see your newly mounted drive.  However, to boot this drive automatically at startup, you will need the following.

Create Auto Mount.

TBD

sudo nano /boot/cmdline.txt

Added:  rootdelay=5

Resources

 

Leave a Reply

Your email address will not be published. Required fields are marked *

eight + 5 =