how-to, how to

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.

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.
      how-to, how to
  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.
    how-to, how 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.
    how-to, how to
  4. Select Format Disk, specify the Erase Method and Partitioning Style, and click on Format.
    how-to, how to
  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.
    how-to, how to
  2. Then, use the sudo umount command to unmount the hard drive.
  3. Next, use the sudo mkfs -t command to format the partition with your preferred file system (ex. ext4, ntfs, vfat).
    how-to, how to
  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

how-to, how to

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

how-to, how to

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.

TECH NEWS RELATED

How to Undervolt Your CPU With Throttlestop in Windows

The more strenuous the tasks you carry out on your PC, the more your CPU (processor) will heat up and the more vital it is to reduce CPU temperature. This becomes particularly noticeable during gaming or heavyweight video-editing, but your CPU may be prone to overheating anyway if it’s ...

View more: How to Undervolt Your CPU With Throttlestop in Windows

Dragon Ball FighterZ Getting PS5, Xbox Series X|S Versions, & Rollback Netcode

During the celebrations for EVO 2022 Bandai Namco revealed news about its popular fighting game Dragon Ball FighterZ. The game is coming to PS5 and Xbox Series X|S, with a release date not yet announced. Upgrade will also be offered for free to those who have the PS4 and ...

View more: Dragon Ball FighterZ Getting PS5, Xbox Series X|S Versions, & Rollback Netcode

How to Access Your Linux (WSL) Files in Windows 10

Windows 10’s May 2019 Update introduced an easy, safe, and officially supported way to access and work with your Linux files from within File Explorer and other applications. Here’s how to get at your Windows Subsystem for Linux (WSL) files. Unlike previous methods, this is a safe way to ...

View more: How to Access Your Linux (WSL) Files in Windows 10

Samsung Galaxy Z Fold4 and Z Flip4 spotted in live images

Both Samsung Galaxy Z Flip4 and Z Fold4 are coming this week on August 10 at the Galaxy Unpacked 2022 launch event. Apparently, live images of both the foldable devices have appeared on the web showcasing a mesmerizing blue color shade that will debut with the two foldable devices ...

View more: Samsung Galaxy Z Fold4 and Z Flip4 spotted in live images

How to Manage Google Meet Invites From Google Calendar

Koshiro K/Shutterstock.com When you schedule a Google Meet through Google Calendar, you can manage your invitees right from the Meet interface. See who you invited, their RSVP status, notes, and if you made them optional. You can also open a Google Chat from Meet for those attendees who haven’t ...

View more: How to Manage Google Meet Invites From Google Calendar

Samsung’s Galaxy Z Fold 4 Won’t Have an S Pen Slot

Samsung via Equal Leaks Rumors suggested that the Galaxy Z Fold 4 could feature a dedicated S Pen slot, much like the Galaxy S22 Ultra or older Galaxy Note devices. But an accidental Amazon listing proves that the phone cannot hold an S Pen without an add-on case. The Amazon ...

View more: Samsung’s Galaxy Z Fold 4 Won’t Have an S Pen Slot

How to Enable Full Screen Caller ID in Truecaller

Even though you have plenty of apps for caller identification, the Truecaller is the most popular and offers many features. The caller identification app is available for both Android & iOS, and it keeps getting new features now and then. TrueCaller recognizes the calls and provides you options to ...

View more: How to Enable Full Screen Caller ID in Truecaller

Disco Elysium keeps crashing or freezing on PC

In the genre of role-playing video games, Disco Elysium has amassed a sizable fan base. However, some players experience compatibility problems and are unable to play the game. We have discussed potential solutions to the problem in this post. This post is for you if Disco Elysium keeps crashing or ...

View more: Disco Elysium keeps crashing or freezing on PC

How to Reset Illustrator Preferences on Windows PC

How to Turn Off Focused Inbox in Microsoft Outlook

How to Disable App Diagnostics in Windows 11

Melty Blood: Type Lumina Reveals Extensive Upcoming Updates at EVO 2022

How to send a Calendar Event as an attachment in Outlook

Granblue Fantasy Relink Is “At the Peak of Development;” New Glimpse of Gameplay Revealed

How to Restart a Computer

Spotify Finally Fixes Its Stupid Play Button

How to sell ammo in Fallout 76

Error 1053: The service did not respond to the start or control request in a timely fashion

How to solve the Relay Stone puzzle in Pudding Isle in Genshin Impact – Summertime Odyssey event

AMD upgrades the Ryzen Embedded series with Zen 3 and a 10-core model

OTHER TECH NEWS

Top Car News Car News