
Get started
- Wipe: We remove the partitions so that we can start with a clean drive.
- Partition: A partition is a logical division on a hard drive. We create a partition to be able for format it.
- Format: We format the partition to create a filesystem suited for our Linux System.
- Mount: We mount the drive using UUID so that the system remembers the connected drive after reboot.
- Permissions: We need to set the permissions of the mounted drive folder to read and write for our Linux user
Wipe all partitions
Get the drive name
First we need to identify the drive name in order for us to wipe it.
lsblk

Remove partition
Now we will remove the first and only partition the drive sdb contains sdb1. Your drives can be found in the folder /dev.
sudo gdisk /dev/sdb
It will ask you for a command, answer with d to delete the single partition. If you have more than one, it will ask you which one to remove.
GPT fdisk (gdisk) version 1.0.5
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): d
Using 1
Now answer with w to write the changes we made.
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
Answer with Y to confirm.
Do you want to proceed? (Y/N): Y
Create a partition
Now that the drive is wiped, we can start creating our partition so the drive can be used on our Linux system.
sudo gdisk /dev/sdb
Answer with n to create a new partition.
GPT fdisk (gdisk) version 1.0.5
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): n
We want to create 1 partition, answer with this number.
Partition number (1-128, default 1): 1
Press enter 3 times to use the default options.
First sector (34-11721045134, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-11721045134, default = 11721045134) or {+-}size{KMGTP}:
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Now answer with w to write the changes we made.
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
Answer with Y to confirm.
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
Format
We will now format the partition we created to ext4.
ext4 journaling file system fourth extended filesystem Learn more
sudo mkfs.ext4 /dev/sdb1
These are all the options if you're not looking to format your drive for a Linux System or simply prefer something else:
- Ext2
- Ext3
- Ext4
- BFS
- FAT
- NTFS
- MINIX
- VFAT
- CRAMFS
- MSDOS
Learn more about these filesystems here.
Mounting
Create the folder where you want to mount your drive.
sudo mkdir /media/hdd
Find the UUID of the partitioned drive we created.
blkid /dev/sdb1

Now we will mount the drive in /etc/fstab to make sure the drive stays connected after rebooting.
sudo nano /etc/fstab
At the end of the file and the following line.
UUID=d65b638e-55b5-4c05-8d97-ad32c20189ed /media/hdd ext4 defaults 0 0
Edit your UUID and the path to the folder your drive should connect to. Save the file and exit.
Finally reboot your system and your drive will be mounted to the path that you chose.
sudo reboot
Permissions
Now that the drive is mounted we need to set its permissions to read and write for our Linux user. My username is ubuntu.
sudo chown ubuntu /media/hdd
Something went wrong?
If something went wrong and you are stuck in boot, then remove the last line you committed in /etc/fstab .
sudo nano /etc/fstab
sudo reboot
Then restart from the top.