EX200 Create and configure file systems Practice Question
An administrator needs to enable swap on a newly created partition /dev/sdc1. Which two commands should be executed in order?
⚠ Common exam trap
It's easy for candidates to confuse the order of operations or mistakenly think `mount` can be used for swap, or that `mkfs.swap` is a valid command, when in fact swap requires `mkswap` followed by `swapon` and never uses `mount`.
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/sdc1; swapon /dev/sdc1
Enabling swap on a new partition requires first formatting it as swap space with `mkswap`, then activating it with `swapon`. The `mkswap` command writes a swap signature to the partition, and `swapon` enables the kernel to use it as swap. Without `mkswap`, the partition lacks the proper swap filesystem structure and cannot be used for swapping.
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/sdc1; mount /dev/sdc1
Why it's wrong here
The first command, mkswap, correctly writes the swap signature to /dev/sdc1, but mount(8) is the wrong tool for enabling swap. mount attaches filesystems like ext4 or XFS to the directory tree by interpreting a filesystem superblock; swap space has no mount point and is used by the kernel as a raw block device for paging. The result is a properly formatted swap partition that remains inactive, because the kernel only starts swapping after the device is explicitly registered with swapon(8). Therefore this sequence fails to achieve the goal even though it does not destroy anything.
- ✗
swapon /dev/sdc1; mkswap /dev/sdc1
Why it's wrong here
This sequence reverses the required order. The swapon command attempts to read and validate the swap signature (the 'magic string' and version) that mkswap normally writes; on a blank partition it fails immediately with an error like 'swapon: /dev/sdc1: read swap header failed'. Even if the device already had a swap signature from an earlier mkswap, running swapon first would activate an old or unintended swap area, and the subsequent mkswap would overwrite that active signature, rendering the swap area corrupted and unusable. The correct procedure must always format with mkswap before trying to activate with swapon.
- ✗
swapon /dev/sdc1; mount /dev/sdc1
Why it's wrong here
This option is doubly wrong because it both reverses the format/activate order and uses the wrong activation mechanism. Running swapon before mkswap means the kernel finds no valid swap signature on /dev/sdc1 and rejects it, so the device is never enabled. Then mount /dev/sdc1 attempts to read a filesystem superblock, which a swap signature is not, so mount fails as well; swap is not a filesystem and cannot be mounted, even with a type override. The net effect is that nothing useful happens: the partition is neither formatted as swap nor activated, and both commands report errors.
- ✗
mkfs.swap /dev/sdc1; swapon /dev/sdc1
Why it's wrong here
There is no mkfs.swap command in standard Linux distributions; mkswap(8) is the sole dedicated utility for writing a swap signature. While mkfs is a generic front-end for filesystem builders like mke2fs or mkfs.xfs, swap is not a filesystem, so no mkfs helper exists for it. Attempting this would either produce a shell error 'command not found' or, if mkfs is invoked with the argument 'swap', it would fail with an unrecognized filesystem type. Consequently the subsequent swapon command would have nothing to validate, leaving the partition unused and unconfigured.
- ✓
mkswap /dev/sdc1; swapon /dev/sdc1
Why this is correct
This is the correct two-step sequence: first mkswap /dev/sdc1 writes the swap signature (version 2 header with UUID and page count) onto the partition, making it a valid swap area. Then swapon /dev/sdc1 reads that signature, validates it, and registers the device with the kernel's swap subsystem, adding it to the active swap list visible under /proc/swaps. This immediately enables kernel memory paging to the device without requiring a mount point. The order is mandatory because swapon will reject a device that does not already contain a valid swap header.
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.