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?
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.
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.
To format Linux partition using ex2fs on the new disk, run the following command:
# mkfs.ext4 /dev/sdb1
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
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
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.
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
It is important to note that the destination will be overwritten. It is important to ensure the destination is free of important data.
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.