- Before I'm going to tell you how to manage partitions,
let's talk about disk storage options.
So to use disk storage,
partitions should be created
to divide a disk into one or more logical areas for storage.
It's funny
because technically, you don't really need a partition.
You can create a file system directly on top of a disk,
but that makes it unrecognizable
and is really not recommended.
After creating a partition,
on that partition, you will create a filesystem,
and this filesystem takes care of the file allocation.
So the filesystem is a logical collection of files
that comes with solutions
to allocate the file blocks to disk.
Apart from partitions,
there are also advanced storage allocation solutions.
And these include Logical Volume Manager, or LVM.
And this defines flexible volumes for storage allocation.
In Red Hat, you will find Stratis,
which is used for thin provisioning of storage.
And volume management filesystems like ZFS and Btrfs
combine the storage allocation unit with a filesystem.
Different utilities can be used to create partitions
including fdisk, parted, and gdisk.
Now, while working with partitions,
you should know about block devices.
That is because the partitions and the disks
are addressed as block devices.
So how do you find your block devices?
Well, the command to use is lsblk,
and that will show you common block devices
with names like sda,
where sd indicates that it's SCSI disk,
and a indicates that it's the first disk.
There is vda, which is for a KVM virtual disk
or xvda, which is a virtual disk in a Xen environment,
or nvme0n1, which is the first nvme disk.
According to the specific driver
of the hardware that you are using,
you might even find different block devices.
Use lsblk to figure out.
So on the disk devices,
partitions are addressed by adding a number,
so you will get sda1.
And sometimes, if the device name itself contains a number,
you will have P followed by a number
like nvme0n1p1
for partition number one.
Block device names are allocated while booting,
and for that reason, they are subject to change.
That means that it's not a very good idea
to address block devices directly,
but better use persistent naming attributes,
which are labels and UUIDs.
I'll show you those later.
For now, I'm going to show you how to create a partition.