Format HDD on Linux from Terminal
This is a quick one but good to know.
Start with the drive you want to use and check what is on it.
fdisk -l
Then start fdisk
sudo fdisk /dev/sda
Use the following commands shortcuts in fdisk:
- Create a new partition table : g (for GPT, use help for other format)
- Create a new partition : n
Default values work for single partitions. - Write and exit fdisk: w
When you run fdisk -l again, you’ll see a new partition.
That’s it!