Formating & mounting a disk on Linux
On your Linux VM, to do this we need to be the root user and run the following command: fdisk -l, as we can see the new hard drive, 10GB, is assigned to the path /dev/vdb.

After the new hard disk has been identified, the next step is partitioning, for this, we will use the following syntax:
fdisk /dev/vdb

We can see that the process is executed correctly. If we run fdisk -l we can look at the changes in the new disk (/dev/vdb).

Next step is to format the new hard drive with the desired file system using the command
mkfs.ext4 /dev/vdb1

After that we need to create a new directory, in this tutorial we create a new directory called /data:
mkdir /data

The Next step is to mount the new disk in the desired location, in this tutorial we have created a new directory called /data. use command
mount /dev/vdb1/ /data

If we want that partition to be mounted permanently, it will be necessary to edit the file /etc/fstab using the preferred editor and to enter the following line. We keep the change.
/dev/vdb1 /data ext4 default 0 0


After that, use df -h command to see mounted hard drive.

Last updated