EX200 Create and configure file systems Practice Question
An administrator needs to create a new 500MB swap partition on a disk that already has an extended partition. The disk /dev/sda has partitions: /dev/sda1 (primary, /boot), /dev/sda2 (extended), /dev/sda5 (logical, swap, 2GB). The administrator wants to add another swap partition, but fdisk shows no free space. Which approach should be used?
⚠ Common exam trap
Candidates often assume a new partition must be created, overlooking that swap files are a fully supported and simpler alternative when no free partition space exists.
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
✓
Use a file-based swap file
The disk has no free space (the extended partition consumes all remaining space after /dev/sda1, and logical partitions are contained within it). Adding a swap file is the simplest and safest approach: it does not require repartitioning, works with any filesystem, and is fully supported by systemd and swapon. The administrator can create a 500MB file, format it as swap with mkswap, and enable it with swapon.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use LVM to create a logical volume for swap
Why it's wrong here
Using LVM to create a logical volume for swap is incorrect because the scenario explicitly states there is no free space on the disk. LVM requires existing partitions or whole disks to be designated as Physical Volumes before Logical Volumes can be provisioned. Without free space to create an initial partition for a Physical Volume, LVM cannot create the underlying storage required. This option is tempting as LVM provides highly flexible storage management, allowing for easy resizing and creation of swap volumes within an existing LVM infrastructure, which would be the correct approach if free space were available to form a Physical Volume or if the goal was to manage swap within an already configured LVM setup.
- ✓
Use a file-based swap file
Why this is correct
A file-based swap file is the correct choice here because it can be created on any existing mounted filesystem without repartitioning the disk. You create a file (e.g., with fallocate or dd), then format it with mkswap and activate it with swapon, optionally adding an entry to /etc/fstab for persistence. This completely avoids the disk-space constraints and partition-table limitations that block the other options, making it the only immediately viable method to add 500MB of swap.
- ✗
Shrink the filesystem on /dev/sda1 to create free space
Why it's wrong here
Shrinking the filesystem on /dev/sda1, which typically holds /boot, is both risky and impractical. /boot is usually a small, nearly full partition containing essential kernel and initramfs files, so shrinking it yields negligible space and could strand free space in an unusable location. More importantly, resizing a filesystem requires unmounting it, running fsck, and then resizing both the filesystem and the underlying partition with tools like resize2fs and parted, which is intrusive and carries a high risk of data loss—especially when the goal is simple swap creation.
- ✗
Delete /dev/sda5 and recreate it with larger size
Why it's wrong here
Deleting /dev/sda5 and recreating it with a larger size would destroy whatever currently resides on that partition, whether it is an existing swap space or a data-bearing filesystem. If /dev/sda5 is already swap, you would lose its current swap signature and need to recreate it with mkswap, then update /etc/fstab, but the partition's maximum size is still capped by the adjacent physical extent of free space on the disk—if no such contiguous space exists, the recreation cannot enlarge it at all. This approach is disruptive, unnecessary, and could easily cause data loss or boot failures, whereas a swap file achieves the same result non-destructively.
Go deeper
Related to this question
About these practice questions
One of 127 original EX200 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This EX200 practice question is part of Courseiva's free Red Hat 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 EX200 exam.