Courseiva
Troubleshooting →mediumMultiple Choice

XK0-006 Troubleshooting Practice Question

A Linux server has a single disk /dev/sda with LVM. The root logical volume is nearly full and the administrator adds a new disk /dev/sdb to extend it. After creating a physical volume on /dev/sdb and adding it to the volume group, which command should be used to extend the root logical volume and its filesystem in one step?

⚠ Common exam trap

The trap here is assuming that lvextend always resizes the filesystem automatically, when in fact the -r option is required to do so.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

lvextend -r -l +100%FREE /dev/vg0/root

Extending an LVM logical volume and its filesystem in one step is done with lvextend -r (or --resizefs). The -r flag automatically calls the appropriate filesystem resize tool (resize2fs for ext4, xfs_growfs for XFS) after growing the LV. Using -l +100%FREE allocates all remaining extents in the volume group. This avoids a separate manual resize step and works for both ext4 and XFS, making it the most reliable choice.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    vgextend vg0 /dev/sdb && lvcreate -l +100%FREE -n root vg0

    Why it's wrong here

    vgextend adds the new physical volume to the volume group, but lvcreate creates a new logical volume named root, which already exists and would fail. Even if a different name were used, creating a new LV does not extend the existing root LV or its filesystem. This approach does not solve the full root filesystem problem and could cause confusion or data loss if misapplied.

  • ✗

    lvresize -L +10G /dev/vg0/root && resize2fs /dev/vg0/root

    Why it's wrong here

    lvresize only changes the logical volume size, not the filesystem. The subsequent resize2fs command will resize an ext4 filesystem, but if the root filesystem is XFS (common on RHEL), resize2fs will fail because XFS requires xfs_growfs and cannot be shrunk or resized with resize2fs. This two-step approach is error-prone and does not handle XFS, so it is not the best answer for a generic root LV.

  • ✗

    pvresize /dev/sdb && lvextend -L +10G /dev/vg0/root

    Why it's wrong here

    pvresize is used to resize an existing physical volume, not to initialize a new disk for LVM. On a newly added disk, you must first create a physical volume with pvcreate, then add it to the volume group with vgextend. Also, lvextend without -r resizes only the LV, not the filesystem, so the filesystem would remain full until manually grown.

  • ✓

    lvextend -r -l +100%FREE /dev/vg0/root

    Why this is correct

    The -r (or --resizefs) option to lvextend resizes the underlying filesystem together with the logical volume, so the root LV and its filesystem are extended in a single command. Using -l +100%FREE allocates all remaining free extents in the volume group. This is the correct and efficient way to grow the LV and filesystem without a separate resize2fs or xfs_growfs step.

About these practice questions

This XK0-006 question is part of Courseiva's 781-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.