Full Guide on How to Format Drive in Linux

Do you want to know which file system is the best for your Linux OS? Follow this guide and learn more including how to format hard disk Linux and the best data recovery.

Hard Drive Recovery

Format Hard Drive+
  1. How to Clone Hard Drive
  2. How to Format Hard Drive from Bios
  3. Format Hard Drive for Xbox One
  4. How to Format C Drive in Windows 10/7/XP
  5. How to Perform PS4 External Hard Drive Format
  6. How to Format Hard Drive from Bios
  7. Format Hard Drive for Xbox One
  8. How to Format C Drive in Windows 10/7/XP
  9. How to Perform PS4 External Hard Drive Format
  10. How to Format Drive in Linux
  11. How to Format Hard Drive to NTFS
  12. How to Format WD My Passport
  13. How to Format Your Drive to FAT32 System
  14. Format HDD Low Level
  15. Format a BitLocker Encrypted Drive
  16. How to Unformat Hard Disk
  17. How to Format a RAW Drive
  18. Fix Your Hard Drive’s Formatting Issues
  19. How to Format SSD
  20. How to Format your Hard Drive to exFAT File System
  21. How to Format a Hard Drive to FAT32
Hard Drive Recovery+
  1. Top 10 Hard Drive Recovery Tools
  2. How to Recover Lost Data from Maxtor External Hard Drive
  3. How to Recover Data from Hitachi External Hard Drive
  4. How to Recover Data from Dead Hard Drive
  5. How to Recover Data from SimpleTech External Hard Drive
  6. How to Recover A Formatted Hard Drive in 3 Simple Clicks
  7. How to Recover Lost Data from Iomega External Hard Drive
  8. How to Recover Data from Toshiba External Hard Drive
  9. How to Recover Data from Transcend External Hard Drive
  10. Lacie External Hard Drive Data Recovery and Repair
  11. Best Way to Recover Data from a Floppy Disk 
  12. How to Recover Data from HP External Hard Drive
  13. Best Method to Recover Data from Crashed Hard Drive
  14. How to Repair Toshiba Hard Disk
  15. Recover Files from WD My Book External Hard Drive
  16. Ways to Repair Seagate Hard Disk
Fix Hard Drive Error+
  1. How to Fix the Hard Disk 3F0 Error
  2. How To Get Your Hard Drive Live Longer
  3. Perform HDD Bad Sector Repair on Any Hard Drive
  4. Recover Formatted Partition
  5. How to Recover Files from Corrupted Hard Disk
  6. How to Fix Hard Disk not Initialized Error
  7. Fix Fatal Hard Disk Not Detected Error
Hard Drive Tips+
  1. How to Clone a Hard Drive
  2. How to Rescue Data from Hard Drive
  3. How to Fix HDD Write Protected Error
  4. How to Completely Wipe a Hard Drive
Mac Hard Drive Recovery+
  1. Recover Lost Data from Seagate External Hard Drive on Mac
  2. How to Recover Data from Formatted Hard Disk Drive on Mac
  3. How to Recover Data from Seagate Backup
  4. How to Recover Lost Data from Western Digital External Hard Drive
  5. Top 5 Tools for Mac Disk Recovery on Mac
  6. How to Format Toshiba Hard Drive for Mac
  7. Format a Hard Drive for Mac: Ultimate Guide 2021

• Filed to: Hard Drive Recovery • Proven solutions

“I need to format drive Linux terminal and I don’t know the procedure. Any help out there?”

- a question from Quora

It is undeniable that fdisk is the most common command-line based disk manipulation utility for a Linux system. The utility can view, create, resize, delete, change, copy and format drives in Linux.

And it comes handy when a drive isn’t set to fit Linux use, and you want to make it usable. It might require you to give it a file system compatible with Linux.

So, which is the best file system for a Linux system?

Part 1: Which File System is Best for Linux

When formatting partitions on a Linux PC, you’ll see a plethora of offline system options. They don’t have to overwhelm you. And if you aren’t sure of the system file appropriate for Linux, the best option would be Ext4.

Ext4 is the default file system on most Linux distributions because it is the advanced version of the Ext3 file system. It isn’t the most advanced file system, but it works great—it is rock-solid and stable.

Soon, Linux distributors will gradually shift towards BtrFS, which is a new technology undergoing tons of development. Avoid it for now because the risk of data corruption or other problems isn’t worth the potential improvement in speed.

It is important to note that the Ext4 file system is exclusively for Linux systems. If you’re formatting an external drive you want to share with other operating systems like macOS and Windows, you shouldn’t use the Ext4 file system as the device won’t read it. You might want to consider the exFAT or FAT32 format, which is accessible to any device.


Part 2: How to Format a Drive in Linux

There are plenty of graphical tools available for disk partitioning and formatting on desktop Linux systems. The most commonly used are the QTParted and the Gparted.

However, many a time you’ll need to format hard drive from the command line, especially when you’re running a server. When done, you’ll have a partitioned hard drive with a Linux file system ready for use.

It is important to note that formatting or reformatting a hard drive on Linux erases all data on the storage media. It is important you back up all your files before proceeding to format.

Step 1 The first step is to set up a new partition.
  1. Open a terminal window and log in as root. To execute this, press Ctrl + Alt + T to open a terminal window. Start your commands with su to become a Root.

  2. To identify your drive, execute the following from the command prompt as root:
    # fdisk -l | grep '^Disk'
    The output should look like this:
    Disk /dev/sda: 251.0 GB, 251000193024 bytes
    Disk /dev/sdb: 251.0 GB, 251000193024 bytes
  3. The device name describes the entire hard disk.

  4. The fdisk will list the current drives on your Linux system. Select the one you want to format.

  5. To partition the disk, on this case /dev/sdb execute the following command:
    # fdisk /dev/sdb
    Here are all the basic fdisk commands you’ll need:
    M – Prints help
    P – Prints partition table
    N—Create a new partition
    D—delete a partition
    Q—quit without saving changes
    W—Write a new partition table and exit
    To create a new partition, hit the N button, and you’re set for the next step.
Step 2 The second step is formatting the new disk using mkfs.ext4 command

To format Linux partition using ex2fs on the new disk, run the following command:

# mkfs.ext4 /dev/sdb1

Step 3 Then mount the new disk using the mount command

First, create a mount point/disk1. Then use the mount command to mount/dev/sdb1. To execute this, enter the following command:

# mkdir /disk1
# mount /dev/sdb1 /disk1
# df -H

Step 4 Update /etc/fstab file

First, open /etc/fstab. To do that, run the following command:

# vi /etc/fstab

In the end, it will append as follows:

/dev/sdb1 /disk1 ext3 defaults 1 2

Step 5 Next, label the partition

You can label the partition using the e2label command. For instance, if you want to label the partition “Programs,” run the following command:

# e2label /dev/sdb1 /programs

Next time you want to mount the partition, you can use the label name instead of the partition name. And that´s all with formatting a hard drive from the Linux command line.

Part 3: Data Recovery from Formatted Linux Disk

In a perfect world, every byte of your data would be backed up to an external drive or a cloud storage service. And we don’t live in a perfect world.

Maybe, during the formatting session, you might have forgotten to back up your files. And after formatting your Linux disk, you might need to get your data back.

To facilitate the re-getting process of the file, you'll need a file recovery tool for Linux. And data recovery in Linux shouldn’t cost you a fortune. There are tons of free data recovery tools out there. But not all works accordingly.

However, we’ll focus on one that reliable, 100% free, and is specifically build for Linux -Ddrescue Data Recovery Tool.

Ddrescue is an expert freeware for Linux data recovery tool that retrieves data even in the most extreme extent. The tool is powerful beyond formatted-data recovery—it recovers data despite all sorts of disk errors and bad sectors.


Simple Guide to Use Ddrescue

  1. Connect a storage media that is at least 1.5 times larger than the Linux disk you’ve formatted

  2. Identify the names of the drives—the one you want to rescue and the one you want to recover the data to by executing the lsblk command. Let’s say that GNU ddrescure is on /dev/sda1, the drive you want to rescue is/dev/sdb1, and you are copying it to/dev/sdc1, here is the command to run:
    $ sudo ddrescue -f --no-split /dev/sdb1 /dev/sdc1 logfile
    $ sudo ddrescue -f -r3 /dev/sdb1 /dev/sdc1 logfile

It is important to note that the destination will be overwritten. It is important to ensure the destination is free of important data.

Part 4: Data Recovery from Formatted Windows 10 Hard Drive – Recoverit (IS)

Recoverit (IS)

Best Windows 10 Hard Drive Data Recovery Software:

  • An All-in-one Data Recovery Tool: Recoverit (IS)y software combines powerful features to rescue your data from any loss beyond just formatting. The software stretches a notch higher to retrieve data from accidental deletes, virus infection, and nearly all scenarios of data loss.
  • Super intuitive User Interface: Readily recover your hard drive in mere three clicks. No code required. No user manual. Just a 3-click procedure—Select, Scan, and Recover and you retrieve the data you desire.
  • Recover over 1000 Data Types: This tool can also recover any data type such as documents, videos, graphics, emails, and other files.
  • Recover Data from Any Storage Device: These include recovery of storage devices with the file system FAT32, NTFS, FAT16, among other file systems. Furthermore, it can retrieve data from external devices like USB drive, Cameras, Micro SD Card, Hard Drives, among other devices.
  • It is compatible with both Windows and Mac OS system.
icon_security 3,165,867 people have downloaded it


Managing storage devices is always a tricky task and HDD Linux format is no different. Any slight mistake and all your data may be lost or wrongly formatted. Thanks to the available online recovery tools. Ddrescue can come to your rescue at such times. It’s a freeware tool for Linux data recovery. It’s powerful and can recover any data type that is lost in any loss scenario. And if you need to recover formatted Windows or Mac hard drive, then Recoverit (IS) would be a perfect choice.


staff Editor

Hot Articles

Format Hard Drive from Command Prompt in Windows 10
Here to learn how to format hard drive, the method to format pc using cmd, and the way to recover data from a formatted hard disk.
How to Format Hard Drive to FAT32 on Windows 10?
How to format hard drive to FAT32 on Windows 10? Here we offer proven ways to teach you how to format HHD to FAT32 and recover data after formatting.
3 Major Seagate Hard Disk Problems – Ways to Repair Seagate Hard Disk
How to Fix Seagate Hard Drive? Go through this article and find various Seagate Hard Disk repair methods to fix your Seagate Hard Drive.
Format Hard Drive from Bios: A Quick Step-by-Step Guide
Are you wondering how to format hard drive from bios? Read this article to find out when to do it, how to do it, and which are the potential risks.
How to Format Hard Drive for PS4 without Data Loss?
Want to know how to format hard drive for PS4? This guide will help you format ps4 hard drive and recover data from the formatted hard drive.
Disk Not Initialized: Fix It with Proven Ways
Disk not initialized? Fix disk uninitialized with proven ways here! Learn why disk not initialized and how to initialize hard disk without losing data
Best 7 External Hard Drive on Mac: External Storage for Macbook
7 external hard drives for Mac are introduced, and you can learn how to recover data from external hard drive, look and read it here!
How to Recover Overwritten Files on External Hard Drive?
Lost your overwritten files on external hard drive? This guide will teach you how to recover lost overwritten files and prevent them from losing.
Home > > Resource > Hard Drive Recovery > Full Guide on How to Format Drive in Linux