RHEL Disk tip.

Share this link

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
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.5GB552MB3GB=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!

Posted in RHEL7
2 comments on “RHEL Disk tip.
  1. bwchuah623 says:

    I cant solve this question which need to create a swap and LVM partition.

    sdb 8:16 0 8G 0 disk
    ├─sdb1 8:17 0 256M 0 part
    │ └─shazam-storage 253:6 0 400M 0 lvm /storage
    ├─sdb2 8:18 0 256M 0 part
    │ └─shazam-storage 253:6 0 400M 0 lvm /storage
    ├─sdb3 8:19 0 512M 0 part
    │ └─vg1-lvshare 253:4 0 400M 0 lvm
    └─sdb4 8:20 0 512M 0 part

    If there is no more primary partition for me, how I am gonna create the pv for vg and lv while the sdb4 has been use for swap (example). Could you guide me?

    • CertDepot says:

      If I assume that you are using a msdos partition table, you could remove the swap partition (/dev/sdb4), create an extended partition with fdisk instead. You would then create several logical partitions.

RHCSA7: Task of the day

Allowed time: 10 minutes.
Archive and compress the content of the /opt directory (create files if none exists).
Uncompress and unarchive the resulting file in /root

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a caching-only DNS server.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...