For computer file systems, fdisk is a command-line utility that provides disk partitioning functions. In versions of the Windows NT operating system line from Windows 2000 onwards, fdisk is replaced by a more advanced tool called diskpart. Similar utilities exist for Unix-like systems.
To Format a Hard Disk on Linux OS, you need first to create a new partition.
To create it run this command:
After, enter “n” to create new.
Now select the partition. This can be an extended partition and primary partition.
Select a number of partition and finish it.
Now it’s time to create a file system. You can create with just one command:
/sbin/mkfs.ext4 -L /backup /dev/sdb1
After this, mount a File System.
First, create a data directory:
Now, mount a file system to /data:
mount /dev/sdb1 /data
To check all mountings, run this command:
You have successfully Formatted a Hard Disk on Linux Operating System.