During the RHCSA exam, you need to go fast.
When dealing with partition creation, you can’t afford to waste time, searching for information about the current configuration with almost obsolete command like fdisk -l displaying a very cryptic and mostly useless information.
You need to use the right command before starting any disk operation.
This command is called lsblk and stands for LiSt BLocK devices.
# lsblk -a NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 252:0 0 6G 0 disk ├─vda1 252:1 0 390M 0 part /boot └─vda2 252:2 0 5.5G 0 part ├─rhel-swap 253:0 0 552M 0 lvm [SWAP] └─rhel-root 253:1 0 3G 0 lvm /
With the lsblk command, you get quickly the following information about the current disk configuration:
- it is a virtual machine (vda, sda would indicate a physical server),
- there is only one disk /dev/vda of 6GB,
- the disk is divided into two partitions (vda1 and vda2) respectively with a size of 390MB and 5.5GB,
- the vda1 partition is mounted under /boot,
- the vda2 partition consists in two logical volumes (lvm) swap and root in a volume group called rhel,
- the swap logical volume is used by the system as a swapping area ([SWAP]) of 552MB,
- the root logical volume is mounted under / with a size of 3GB,
- there is around 2GB of free available space (5.5GB–552MB–3GB=2GB) in the vda2 partition,
- none of the partitions are in Read-Only mode (RO=0) or ReMovable (RM=0).
By default, the lsblk command skips empty devices. The -a option corrects this behaviour and displays all devices, empty ones included.
With only one command, you get almost everything you need!