Formatting a newly created partition
Your new partition can be formatted once you’ve finished designing the disk’s partition arrangement and are satisfied with it. The results of sudo fdisk -l
will be different now that I have partitioned the new drive.
A new partition, /dev/sdb2
, has been created and is reflected in the output. We can proceed with the formatting at this time. The mkfs
command is used to create the filesystem. In order to execute this operation, you must use the correct syntax, which consists of entering mkfs
, followed by a period (.
), and then the name of the filesystem you wish to create. Using this code as an example, we can format /dev/sdb2
as ext4
by running the sudo mkfs.ext4 /
dev/sdb2
command:
Figure 10.7 – Formatting a partition
It is important to remember to format the partition; otherwise, it won’t be usable.