EX200 Configure local storage Practice Question
An administrator wants to create a swap partition on /dev/sdb1. After creating the partition with fdisk, which command sets up the swap area?
⚠ Common exam trap
Red Hat often tests the distinction between preparing a swap area (`mkswap`) and activating it (`swapon`), so candidates mistakenly choose `swapon` thinking it both creates and enables the swap.
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/sdb1
The correct command to set up a swap area on a partition is `mkswap /dev/sdb1`. This command initializes the partition with a swap signature, writing the necessary metadata (such as the swap superblock and version information) so the kernel can later use it as swap space. Without running `mkswap`, the partition is not recognized as a valid swap device.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
mkswap /dev/sdb1
Why this is correct
mkswap /dev/sdb1 is the correct initial step because it writes the swap signature (UUID and swap superblock) onto the partition, turning it into a usable swap area. Once this initialization is complete, the swap space can be activated with swapon. Without mkswap, the partition lacks the metadata required for the kernel to recognize it as swap.
- ✗
mkfs.swap /dev/sdb1
Why it's wrong here
mkfs.swap /dev/sdb1 is invalid because no such command exists in the util-linux or e2fsprogs suites. The mkswap utility is specifically designed for creating swap areas, while mkfs tools (like mkfs.ext4 or mkfs.xfs) target regular filesystems. Attempting to run this would simply fail with 'command not found'.
- ✗
swapon /dev/sdb1
Why it's wrong here
swapon /dev/sdb1 is wrong for this task because it only activates an existing swap device—it does not create the swap area. If the partition hasn't been initialized with mkswap, swapon will fail with an error indicating that the device is not a swap space. You must first run mkswap to initialize, then swapon to enable it.
- ✗
swapoff /dev/sdb1
Why it's wrong here
swapoff /dev/sdb1 is the opposite of what you need because it deactivates an active swap device, removing it from the kernel's swap pool. It does not set up or initialize a new swap partition, and it would either error out if the device isn't currently enabled or simply disable it if it was somehow not yet initialized. This command is used when you want to discontinue using a swap area, not to create one.
Go deeper
Related to this question
About these practice questions
Courseiva writes every EX200 question from scratch — 427 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.