LPIC-2 Practice Question: Block Devices, Filesystems and Advanced Storage
Which command can be used to create a swap partition on /dev/sdb1?
⚠ Common exam trap
Many exam-takers assume `swapon` alone can both create and activate swap, similar to how `mount` can create a filesystem with `-t` in some contexts, but swap requires explicit initialization with `mkswap` first.
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; swapon /dev/sdb1
B is correct because creating a swap partition requires two steps: first, `mkswap` initializes the partition as a swap area by writing a swap signature (UUID and superblock) to /dev/sdb1; second, `swapon` activates the swap space, making it available to the kernel for paging. Without `mkswap`, the partition lacks the necessary swap metadata and cannot be used.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
swapcreate /dev/sdb1
Why it's wrong here
No such command.
- ✓
mkswap /dev/sdb1; swapon /dev/sdb1
Why this is correct
Correct sequence to create and enable swap.
- ✗
swapon /dev/sdb1
Why it's wrong here
Swapon only activates an existing swap partition.
- ✗
mkfs.swap /dev/sdb1
Why it's wrong here
No such command.
Go deeper
Related to this question
About these practice questions
One of 507 original LPIC-2 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 LPIC-2 practice question is part of Courseiva's free LPI 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 LPIC-2 exam.