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
Section titled “Format drive”-
Identify drive
Section titled “Identify drive”Terminal window # Identify the target drive, i.e., /dev/sdelsblk -
Unmount the partition
Section titled “Unmount the partition”Terminal window sudo umount /dev/sde* -
Install gdisk
Section titled “Install gdisk”Terminal window sudo apt install gdisk exfat-fuse exfatprogs -y -
Start gdisk on the disk
Section titled “Start gdisk on the disk”Make sure you use the disk
/dev/sdenot the partition/dev/sde1Terminal window sudo gdisk /dev/sde -
Delete the existing partition
Section titled “Delete the existing partition”- Type
dto delete the existing partition (/dev/sde1). - Defaults to partition
1.
- Type
-
Create a new partition table
Section titled “Create a new partition table”- Type
oto create a new GPT partition table. - Confirm with
Y.
- Type
-
Create the partition
Section titled “Create the partition”- Type
nto 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)
- Partition number: press
- Type
-
Write changes
Section titled “Write changes”- Type
wto write the changes. - Confirm with
Y.
- Type
-
Format partition as exFAT
Section titled “Format partition as exFAT”Terminal window sudo mkfs.exfat -n MYDRIVE /dev/sde1 -
Verify partition and filesystem
Section titled “Verify partition and filesystem”Terminal window sudo parted /dev/sde print
Mount drive
Section titled “Mount drive”-
Identify mounted drives
Section titled “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 -
Obtain drive UUID
Section titled “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 -
Create a mount point
Section titled “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}} -
Change ownership of mount point
Section titled “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}} -
Modify fstab for auto-mount
Section titled “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 -
Add mount entry to fstab
Section titled “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 -
Unmount external HDD
Section titled “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 -
Reboot or remount
Section titled “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 rebootRemount the HDD without rebooting.
Terminal window sudo mount -o remount {{EXTERNAL_HDD_PATH_VAR}}