When you think Linux, you think code. And while it’s true that the command-line is primarily used for most tasks, including disk management, its not the only option. Most Linux distros offer both easy-to-use GUI based methods, as well as, countless CLI-based methods for advanced users.
Before you start, remember to backup any important files elsewhere if you haven’t already done so. When using the command-line methods, make sure you get the syntax and capitalization correct to avoid common errors. Finally, also make sure that you choose the correct device to format as it’s very easy to mess this up.
Table of Contents
Using GParted
GNOME Partition Editor or GParted is likely the most popular GUI-based partition manager. It owes its popularity to its simple and intuitive interface. Here’s how you can format your hard drive using GParted:
- First, you’ll want to install the GParted package if you don’t already have it.
- On Debian-based distros, use the
sudo apt-get install gparted command
. - On Fedora-based distros, use the
su -c "yum install gparted" command
.
- On Debian-based distros, use the
- After installing it, search and open GParted and input your password for authentication.
- Right-click the hard drive and Unmount it first.
- Select Format to and pick the partitioning style of your choice.
- After you check the pending operations, press Apply All Operations.
- Press Apply to confirm.
GNOME Disks
GNOME Disks is a partition manager that serves as a graphical front-end for udisks. This utility comes preinstalled with various distros, including Ubuntu. Here’s how you can format your hard drive using GNOME Disks:
- Open the File Browser, right-click the HDD and select Format.
- Alternatively, search disks and open the Disks utility.
- Select your HDD from the left pane and click on the Drive Options button.
- Select Format Disk, specify the Erase Method and Partitioning Style, and click on Format.
- Check the affected devices list and click on Format.
- Input your account password to confirm and proceed.
Make File System (mkfs)
The mkfs utility comes baked in with most Linux distros. It’s used to format block storage devices with a specific file system. Here are the steps to format your hard drive using this command:
- First, use the
df -h
command to list the mounted file systems. - Then, use the
sudo umount <device>
command to unmount the hard drive. - Next, use the
sudo mkfs -t <fs> <device>
command to format the partition with your preferred file system (ex. ext4, ntfs, vfat). - Afterward, you can use the
lsblk -f
command to verify the changes.
Using Shred
The shred utility is used to overwrite your data repeatedly so that the deleted data can’t be recovered later. The basic syntax for this command is as follows:
shred <options> <device>

The device portion refers to your HDD mount point, but the options will vary depending on the usage case. You can use shred --help
for the full list, but here are some useful ones to start with:
-f, --force change permissions to allow writing if necessary
-n, --iterations=N overwrite N times instead of the default (3)
-v, --verbose show progress
-z, --zero add a final overwrite with zeros to hide shredding
Using dd
The dd utility is commonly used in Unix-like systems to copy and convert files. But you can also use this utility to zero-fill, or write random data to your hard drive. Shred is considered more secure as it offers multiple overwrites, but dd is generally faster. Ultimately, it’s up to you to choose which one to use.
With that said, the basic syntax for dd is as follows:
dd if=source of=targetdevice <options>

If you wanted to write random data to the drive mounted at /dev/sda
instead of zeros, you could use the following command instead:
dd if=/dev/urandom of=/dev/sda bs=16M