EX200 Configure local storage Practice Question
An administrator needs to add a 2GB swap partition to an existing disk (/dev/sdc) that already has one partition. The administrator creates a second primary partition using fdisk and sets the type to Linux swap (82). Which command completes the setup to enable swap?
⚠ Common exam trap
Red Hat often tests the distinction between formatting a filesystem (`mkfs`) and initializing swap (`mkswap`), leading candidates to mistakenly use `mkfs.swap` or skip the initialization step entirely.
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
✓
mkswap /dev/sdc2 && swapon /dev/sdc2
After creating the partition with fdisk and setting the type to 82 (Linux swap), the partition must be formatted as a swap area using `mkswap` before it can be activated. The `swapon` command then enables the swap space. Option C correctly chains `mkswap /dev/sdc2` to initialize the swap signature and `swapon /dev/sdc2` to activate it.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
swapon /dev/sdc2
Why it's wrong here
Running swapon directly on /dev/sdc2 will fail because swapon requires the device to already contain a valid swap signature, which only mkswap can create. Without that initialization, the kernel does not recognize the partition as swap space and returns an error such as "swapon: /dev/sdc2: read swap header failed." You must first run mkswap /dev/sdc2, and then activate it with swapon.
- ✗
mkfs.swap /dev/sdc2 && swapon /dev/sdc2
Why it's wrong here
The command mkfs.swap does not exist in standard Linux utilities; the correct tool for preparing a swap area is mkswap, part of the util-linux package. The mkfs.* commands are used to create regular filesystems such as ext4 or xfs, but swap is not a filesystem and has its own dedicated on-disk format. Because mkfs.swap is not found, the shell reports "command not found" and the && chain short-circuits, so swapon is never even attempted.
- ✓
mkswap /dev/sdc2 && swapon /dev/sdc2
Why this is correct
mkswap /dev/sdc2 writes the swap signature and metadata to the /dev/sdc2 partition, preparing it for use as swap space. Then swapon /dev/sdc2 activates it immediately, making the kernel use it for paging. This two-step sequence is the correct procedure, and you can verify that it worked with swapon --show or by checking the output of free.
- ✗
mkswap /dev/sdc && swapon /dev/sdc
Why it's wrong here
mkswap /dev/sdc targets the entire disk rather than the partition /dev/sdc2, which would overwrite the disk's partition table and corrupt any existing partitions on that disk. Even if swapon on the whole disk were to succeed afterward, the system would no longer have a valid partition layout, risking data loss and the inability to mount other partitions. Always specify the partition device (e.g., /dev/sdc2) when initializing and enabling a swap partition.
Go deeper
Related to this question
About these practice questions
This EX200 question is part of Courseiva's 127-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 →
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.