Skip to content

External HDD setup

Step-by-step guide to partition, format and auto-mount an external drive with GPT and exFAT for use across Windows, macOS and Linux.



Format drive

  1. Identify drive

    Terminal window
    # Identify the target drive, i.e., /dev/sde
    lsblk
  2. Unmount the partition

    Terminal window
    sudo umount /dev/sde*
  3. Install gdisk

    Terminal window
    sudo apt install gdisk exfat-fuse exfatprogs
  4. Start gdisk on the disk

    Make sure you use the disk /dev/sde not the partition /dev/sde1

    Terminal window
    sudo gdisk /dev/sde
  5. Delete the existing partition

    • Type d to delete the existing partition (/dev/sde1).
    • Defaults to partition 1.
  6. Create a new partition table

    • Type o to create a new GPT partition table.
    • Confirm with Y.
  7. Create the partition

    • Type n to create a new partition.
    • Follow the prompts to create a partition with the default values:
      • Partition number: press Enter (default is 1)
      • First sector: press Enter (default)
      • Last sector: press Enter (default)
      • Partition type: 0700 (Microsoft basic data)
  8. Write changes

    • Type w to write the changes.
    • Confirm with Y.
  9. Format partition as exFAT

    Terminal window
    sudo mkfs.exfat -n MYDRIVE /dev/sde1
  10. Verify partition and filesystem

    Terminal window
    sudo parted /dev/sde print

Mount drive

  1. Identify mounted drives

    The first step is to identify the drives that are currently mounted on your system. This will help you locate the external HDD and determine where it’s currently mounted, if at all.

    Terminal window
    lsblk
  2. Obtain drive UUID

    Each drive in Linux has a unique identifier called the UUID. This step shows you how to obtain the UUID of your external HDD, which will be used for reliable mounting.

    Terminal window
    sudo blkid /dev/sda1
  3. Create a mount point

    A mount point is a directory where your external HDD will be accessed. In this step, you’ll create a directory that will serve as the location for your drive’s mount.

    Terminal window
    sudo mkdir -p {{EXTERNAL_HDD_PATH_VAR}}
  4. Change ownership of mount point

    After creating the mount point, it’s important to set the appropriate ownership and permissions for the directory. This ensures that the user or group can access the external HDD properly.

    Terminal window
    sudo chown -R $USER:$USER {{EXTERNAL_HDD_PATH_VAR}} && sudo chmod -R 755 {{EXTERNAL_HDD_PATH_VAR}}
  5. Modify fstab for auto-mount

    The /etc/fstab file controls how filesystems are mounted during system boot. This step shows you how to modify fstab to automatically mount your external HDD every time the system starts.

    Terminal window
    sudo nano /etc/fstab
  6. Add mount entry to fstab

    You’ll add a new line to the fstab file, below other entries, to specify how your external HDD should be mounted. This entry ensures the drive is automatically mounted at boot time using its UUID.

    Terminal window
    UUID={{EXTERNAL_HDD_UUID_VAR}} {{EXTERNAL_HDD_PATH_VAR}} ext4 auto,nofail,noatime,rw,users,exec 0 0
  7. Unmount external HDD

    Before making permanent changes, unmount the drive to ensure it’s safely disconnected from the system. This step avoids any potential data corruption while you edit configuration files.

    Terminal window
    sudo umount /dev/sda1
  8. Reboot or remount

    Once all changes are made, reboot your system to apply the fstab modifications and ensure that your external HDD mounts correctly at startup.

    Terminal window
    sudo reboot