Special thanks advices from Samuel Amoah-Danquah | LinkedIn.
In simple term, filesystem is the format of partition.
Similar to Windows OS, user may format partition/USB into FAT32, exFAT, NTFS etc.
There's many filesystems type in Linux, here's only introduce most common use one.
For general use, may choose ext4 instead xfs.
When using mkfs set the size of partition, for xfs, you can't decrease the size but only increase the size.
However, for ext4, you can increase/decrease the size in anytime in the future.
mkfs.[Filesystem] [Partition]
Running mkfs on a partition completely erases all existing data on that partition.
Tutorial
Create new partition
Refer to 43 - Create Partition >> 43.1 Add a New Hard Disk in VirtualBox & 43.2 Create Primary Partition
Verify unformatted partition
Refer to FSTYPE column, should be empty
lsblk -f
Unmount the partition
sudo umount [Partition]
Example: sudo umount /dev/sdb1
Format the partition
Example: sudo mkfs.xfs /dev/sdb1
Verify
Refer to FSTYPE column, should be xfs
lsblk -f
Result
student@localhost:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 xfs c328699d-a4d0-45fb-b9a0-040e052cb223 376.8M 61% /boot
└─sda3 LVM2_member LVM2 001 QomEar-pLja-RjXl-fwgd-odjM-3x6m-YPL4DV
├─rhel-root xfs d0a1ded0-c164-4267-818d-a8758e63097f 15.8G 26% /
└─rhel-swap swap 1 7f7fdf85-ea53-4a69-8a9f-4b62d9cc96a2 [SWAP]
sdb
└─sdb1
sr0
student@localhost:~$ sudo umount /dev/sdb1
umount: /dev/sdb1: not mounted.
student@localhost:~$ sudo mkfs.xfs /dev/sdb1
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=1
= reflink=1 bigtime=1 inobtcount=1 nrext64=1
= exchange=0 metadir=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
= rgcount=0 rgsize=0 extents
= zoned=0 start=0 reserved=0
student@localhost:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 xfs c328699d-a4d0-45fb-b9a0-040e052cb223 376.8M 61% /boot
└─sda3 LVM2_member LVM2 001 QomEar-pLja-RjXl-fwgd-odjM-3x6m-YPL4DV
├─rhel-root xfs d0a1ded0-c164-4267-818d-a8758e63097f 15.7G 27% /
└─rhel-swap swap 1 7f7fdf85-ea53-4a69-8a9f-4b62d9cc96a2 [SWAP]
sdb
└─sdb1 xfs a3bc3f46-0efb-4b5e-8146-8d2ea0cf62ff
sr0
Don't need to clean up if you want to proceed next chapter
Follow 43 - Create Partition >> 43.5 Cleanup - Delete Hard Disk