CompTIA certification · Exam XK0-006

XK0-006 Mock Exam

CompTIA Linux+ V8

Free XK0-006 questions on Storage and Filesystems, each with the answer and an explanation.

20 questions · 21 minutes · free, no sign-up

Storage and Filesystems questions

1–1 of 1 free
Question 1 Choose 1
An administrator added a new disk to expand the current storage. Which of the following commands should the administrator run first to add the new disk to the LVM?
Show answerHide answer

Correct answer: C pvcreate

Explanation

Explanation:

When adding a new disk to expand LVM storage, the very first step is to initialize the disk as a Physical Volume (PV) using the pvcreate command. This prepares the disk for use in LVM by writing LVM metadata to it.

The LVM Storage Workflow:
When adding new storage to LVM, you must follow this specific order:
Step 1: pvcreate → Step 2: vgextend → Step 3: lvextend
(Initialize disk) (Add PV to VG) (Extend logical volume)

Why pvcreate must come first:
- pvcreate initializes the new disk with LVM metadata
- Writes LVM headers to the disk
- Divides the disk into physical extents
- Makes the disk recognizable as an LVM physical volume
Only after pvcreate can the disk be added to a volume group with vgextend
Finally, you can extend logical volumes with lvextend to use the new space

Example workflow:
# 1. Identify the new disk
lsblk
# Output shows /dev/sdb is the new unpartitioned disk

# 2. Initialize as physical volume (FIRST STEP)
sudo pvcreate /dev/sdb

# 3. Verify it's created
sudo pvs
# or
sudo pvdisplay

# 4. Add to existing volume group
sudo vgextend my_volume_group /dev/sdb

# 5. Extend logical volume
sudo lvextend -L +10G /dev/my_volume_group/my_logical_volume

# 6. Resize filesystem (if needed)
sudo resize2fs /dev/my_volume_group/my_logical_volume
# or for XFS:
sudo xfs_growfs /mount/point

Why other options are incorrect:
❌ vgextend: This command adds a physical volume to a volume group. Cannot be used first because it requires an existing PV. Would fail with error: "Device /dev/sdb not found (or ignored by filtering)". Only valid AFTER pvcreate.

❌ lvextend: This command expands a logical volume. Requires free space in the volume group. Cannot be used first because the disk isn't even in LVM yet. Would fail: "Insufficient free space" (the new disk isn't available to LV).

❌ pvresize: This command resizes an existing physical volume. Used when you've expanded the underlying disk (virtual disk resize). Not for adding new disks. Would fail on a new disk: "Device /dev/sdb not found in LVM".

Complete LVM Disk Addition Process:
# Step 0: Verify new disk is detected
fdisk -l /dev/sdb
# or
lsblk

# Step 1: Create partition (optional but recommended)
fdisk /dev/sdb
# Create a single partition /dev/sdb1 with type 8e (Linux LVM)

# Step 2: Initialize as physical volume
pvcreate /dev/sdb1

# Step 3: Add to volume group
vgextend my_vg /dev/sdb1

# Step 4: Extend logical volume
lvextend -L +20G /dev/my_vg/my_lv

# Step 5: Resize filesystem
resize2fs /dev/my_vg/my_lv

LVM Command Summary:
Command Purpose When Used
pvcreate Initialize disk for LVM First step with new disk
pvdisplay Show PV details Verification
vgextend Add PV to volume group After pvcreate
lvextend Grow logical volume After adding space to VG
pvresize Resize existing PV After underlying disk grew

Reference:
LVM = Logical Volume Manager
PV = Physical Volume (disk or partition)
VG = Volume Group (pool of storage)
LV = Logical Volume (virtual partition)
The order is critical: PV → VG → LV
Skipping pvcreate is like trying to pour water into a bottle that doesn't exist yet

That's the last free question in Storage and Filesystems

You've seen the free 30% (1 of 2 questions). Full access unlocks every question and full-length XK0-006 mock exams (87 questions, 90 minutes), a different mock on every attempt.

Unlock full mock exam
Full mock exam

Sit the XK0-006 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real XK0-006 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full XK0-006 mock exam
  • 87questions per mock
  • 90 mintime limit
  • 150questions in the bank
  • Newmock on every attempt