Tech News Today
  • Hardware
    • Motherboards
    • CPUs
    • Graphic Cards
    • RAM
    • SSDs
    • Computer Cases
    • Monitors
    • Peripherals
    • Power Supply Unit
    • PC Builds
    • Computer Tips
  • Software
  • Operating System
    • Windows
    • Mac
  • Gaming
  • Mobile
  • Console
  • More
    • Internet
    • Networking
    • Security
    • Buyer’s Guide
    • Gadgets
    • Laptops
    • Reviews
    • How To
    • News
Facebook Twitter Instagram
Tech News Today
  • Hardware
    • Motherboards
    • CPUs
    • Graphic Cards
    • RAM
    • SSDs
    • Computer Cases
    • Monitors
    • Peripherals
    • Power Supply Unit
    • PC Builds
    • Computer Tips
  • Software
  • Operating System
    • Windows
    • Mac
  • Gaming
  • Mobile
  • Console
  • More
    • Internet
    • Networking
    • Security
    • Buyer’s Guide
    • Gadgets
    • Laptops
    • Reviews
    • How To
    • News
Tech News Today
Home»Operating System»Linux»How To Format Hard Drive On Linux?

How To Format Hard Drive On Linux?

AnupBy AnupAugust 4, 2022
format hard drive linux

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.

When it comes to formatting, it’s important to consider not just the how, but also the why. If you’re simply trying to clear up space, you can use your preferred method as they’ll all work fine. However, if you plan to format the drive and sell it, it’s important to properly wipe the drive so that none of the data can be recovered later.

With these things in mind, we’ve listed various ways to format a hard drive on Linux. You can go through the list and pick the best one for your specific purpose.

Table of Contents

  • Ways to Format Hard Drive On Linux
    • Using GParted
    • GNOME Disks
    • Make File System (mkfs)
    • Using Shred
    • Using dd
  • Related Questions
    • Should I Format My Hard Drive To NTFS On Linux?
    • How Do I Clean Wipe My Hard Drive On Linux?
    • Do I Need To Format Hard Drive Before Installing Ubuntu?
    • How to Factory Reset Ubuntu?

Ways to Format Hard Drive On Linux

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.

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:

  1. 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.
      sudo-apt-get-install-gparted
  2. After installing it, search and open GParted and input your password for authentication.
  3. Right-click the hard drive and Unmount it first.
  4. Select Format to and pick the partitioning style of your choice.
    gparted-format-to
  5. After you check the pending operations, press Apply All Operations.
  6. 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:

  1. Open the File Browser, right-click the HDD and select Format.
  2. Alternatively, search disks and open the Disks utility.
  3. Select your HDD from the left pane and click on the Drive Options button.
    gnome-disks-format-disk
  4. Select Format Disk, specify the Erase Method and Partitioning Style, and click on Format.
    overwrite-existing-data-with-zeroes
  5. Check the affected devices list and click on Format.
  6. 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:

  1. First, use the df -h command to list the mounted file systems.
    df-h-ubuntu
  2. Then, use the sudo umount <device> command to unmount the hard drive.
  3. Next, use the sudo mkfs -t <fs> <device> command to format the partition with your preferred file system (ex. ext4, ntfs, vfat).
    sudo-mkfs-t-ntfs
  4. 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>
sudo-shred

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>
sudo-dd

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

Related Questions

Should I Format My Hard Drive To NTFS On Linux?

Linux cannot boot from an NTFS partition, so you can’t have the entire hard drive formatted as NTFS. During the installation, you’ll have to specify ext4 or a similar file system.

On the other hand, you can format part of the drive, or an external drive as NTFS, exFAT, or any other file system of your preference.

If your system is Linux only, you’d have the best performance by just using ext4. But if you have a dual boot system, for instance, having certain partitions, or an external drive formatted as NTFS makes sense. 

How Do I Clean Wipe My Hard Drive On Linux?

Clean wiping involves overwriting the drive multiple times so that the chance of data recovery is minimal afterward. Most Linux distros support hundreds of partitioning and formatting tools, and as most of them work fine, it’s up to you to choose which one to use.

If you’re looking to completely wipe your hard drive, we recommend using shred as it uses overwriting patterns designed to destroy residual data as much as possible. We’ve detailed further how you can use it in the sections above.

Do I Need To Format Hard Drive Before Installing Ubuntu?

This is entirely up to personal preference. If you plan to run a Ubuntu-only system, it’s generally recommended to backup the important files elsewhere and format the drive for a clean install.

On the other hand, if you plan to dual-boot Ubuntu and Windows, formatting isn’t an option. Instead, you can simply adjust the sizes for the Ubuntu and Windows partitions during the installation.

How to Factory Reset Ubuntu?

As always, remember to backup any important data elsewhere before proceeding with the following steps:

  1. With BIOS, press and hold the Shift key when booting. In the case of UEFI, press Esc a few times instead.
  2. In the GNU GRUB boot loader screen, select the Restore Ubuntu to factory state option.
  3. Next, select Restore Linux OS partitions and press Continue.  
how-to
Anup

Anup has been tinkering with PCs for over 15 years. At Tech News Today, he mainly covers Windows systems, networking, and hardware related issues.

Related Posts

ubuntu wifi not working

Ubuntu WiFi Not Working? Here’s How To Fix It

July 17, 2022
transfer file from linux to windows

How To Transfer File From Linux To Windows

July 6, 2022
linux cpu temperature

How To Check CPU Temperature On Linux

June 20, 2022
Add A Comment

Leave A Reply Cancel Reply

Latest Posts
optical-vs-laser-mouse-whats-the-difference

Optical Vs Laser Mouse – What’s the Difference?

August 3, 2022
best-pokemon-game-for-switch

12 Best Pokémon Games for Switch in 2022

August 3, 2022
games-like-mount-and-blade

12 Games Like Mount and Blade in 2022

August 3, 2022
You may also like
format hard drive linux

How To Format Hard Drive On Linux?

August 4, 2022
oculus-air-link-not-working

Oculus Air Link Not Working? Here’s How to Fix It?

August 3, 2022
no sd card slot

Laptop Has No SD Card Slot? Here’s What You Can Do

August 3, 2022
Recommended
Cookie Clicker Garden Guide

Cookie Clicker Garden Guide to Unlocking Every Seed

September 26, 2021
monitor no signal

Computer Turns On But Monitor Says No Signal (9 Ways To Fix)

October 25, 2021
Facebook Twitter Pinterest
  • Home
  • About Us
  • Privacy Policy
  • Affiliate Disclosure
© 2022 TechNewsToday.

Type above and press Enter to search. Press Esc to cancel.