Rapsberry Pi Logo

Raspberry Pi Setup – Part 1 – Adding a Large External Drive


The Raspberry Pi is an awesome device with lots of potential. This is the first part in a series of articles to get the most out of the device. I’m currently using my Raspberry Pi to serve a slew a functionality. From being a network drive to store media to eliminating ads on the network. Before we begin, start off with using the proper power supply. To save yourself headache, just buy the official Pi Power Supply for your board.

To start we are going to add a powered 8TB external hard drive and have it remount to the same folder every time the Pi is restarted. This is important so that you can rely on referencing this drive later. The instructions assume you’re comfortable with a command line.

[siteorigin_widget class=”SiteOrigin_Widget_Image_Widget”][/siteorigin_widget]


  1. Open a terminal (Mac) or cmd (Windows) and ssh into the device. This command assumes the Pi is running on a specific IP
    1. Enter: ssh pi@
    2. default password is raspberry, you’ll likely want to change that after you login.
  2. Connect the external drive to the USB port and check that it’s connected successfully.
    1. Enter: sudo blkid

      /dev/sda1: LABEL=”seagate” UUID=”f6bfecc7-8a48-45c1-a126-7c7630cffae6″ TYPE=”ext4″ PARTLABEL=”Linux filesystem” PARTUUID=”1f96b357-2793-482d-8e0b-77addd5ee34e”

    2. From here we are going to assume the drive is on /dev/sda1
  3. Partition the Drive – We assume here that you want to fresh empty disk. Enter the following commands. Skip to step 6 if you do not want to delete any files on the drive. 
    1. Start by downloading gdisk, as it supports large disk formats and I’m using an 8TB drive in this example. sudo apt-get install gdisk
    2. sudo gdisk /dev/sda
    3. Enter p to list the current partitions on the drive

      Enter d to delete the partitions (there may be more than one)

      Enter n to create a new partition

      Hit Enter on each prompt to accept the defaults. Note that the Hex code tells the OS what type of drive this is. The default is 8300 for a ‘Linux filesystem’

      Enter w to write the changes

  4. Now the new partition will be visible on fdisk. Enter this command to view it.
    1. Enter: sudo fdisk -l /dev/sda

      You will then see:

      Disk /dev/sda: 7.3 TiB, 8001563221504 bytes, 15628053167 sectors

      Disk model: Expansion Desk 

      Units: sectors of 1 * 512 = 512 bytes

      Sector size (logical/physical): 512 bytes / 4096 bytes

      I/O size (minimum/optimal): 4096 bytes / 4096 bytes

      Disklabel type: gpt

      Disk identifier: 8FCB3584-1929-43D6-90CF-0711129223F5

      Device     Start         End     Sectors Size Type

      /dev/sda1   2048 15628053133 15628051086  7.3T Linux filesystem

  5. We are going to create an ext4 partition that is most common for Raspberry Pi drives. Choosing others is possible (ex. vfat, ntfs, exfat).

    When using this command with ext4 we can give it a label. In this case ‘myusbdrive’

    1. Enter: sudo mkfs.ext4 /dev/sda1 -L myusbdrive
  6. The drive cannot be used yet until its mounted.
    1. Create a folder to mount the drive to. You can choose any location.
      sudo mkdir -m 1777 /media/myusbdriveshare
    2. Now mount to that folder

      sudo mount /dev/sda1 /media/myusbdriveshare

    3. To unmount

      sudo umount /dev/sda1

  7. Set up the Automount upon next boot to keep the drive pinned to that new folder.Add drive by enter a line in the fstab file. You can reference the drive using UUID or LABEL. There are a few options to set here, the most important is nofail since it will allow the computer to boot even if there is trouble mounting the drive.
    1. Enter: sudo nano /etc/fstab
    2. Add one of the following lines:LABEL=myusbdrive /media/myusbdriveshare ext4 defaults,nofail,auto 0 2


      UUID=f6bfecc7-8a48-45c1-a126-7c7630cffae6 /media/myusbdriveshare ext4 defaults,nofail,auto 0 2

      Note that the UUID is from step 2 by entering: sudo blkid /dev/sda1

  8. Reboot your pi and confirm the drive is still correctly mounted
    1. Enter: sudo reboot
    2. After reboot login and run

      Enter: df -H

    3. You should see your drive in the list

So what now?

At this point we have set a newly connected external drive to automount on start up to a specific folder. We can now reference this folder later in subsequent parts of this Raspberry Pi series of articles.

[siteorigin_widget class=”SiteOrigin_Widget_Image_Widget”][/siteorigin_widget]