Courseiva
Block Devices, Filesystems and Advanced StoragemediumMultiple SelectObjective-mapped

LPIC-2 Practice Question: Block Devices, Filesystems and Advanced Storage

Which two commands can be used to create a swap space on a partition /dev/sdb2? (Choose two.)

⚠ Common exam trap

Test-takers frequently confuse `mkswap` (which creates the swap filesystem) with `swapon` (which activates it), or they assume a generic `mkfs.*` command exists for swap, leading them to pick the invalid `mkfs.swap` option.

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/sdb2

The `mkswap` command initializes a partition or file for use as swap space by writing a swap signature (UUID and superblock) to the device. Option A is correct because `mkswap /dev/sdb2` creates the swap filesystem on the specified partition. Option D is also correct because `mkswap -L swap /dev/sdb2` does the same but additionally assigns a label 'swap' to the swap area, which is a valid variant of the command.

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/sdb2

    Why this is correct

    mkswap writes a swap signature to the partition.

  • swapon /dev/sdb2

    Why it's wrong here

    swapon activates a swap area; it does not create one.

  • dd if=/dev/zero of=/dev/sdb2 bs=1M count=1024

    Why it's wrong here

    This overwrites the partition with zeros but does not create a swap filesystem.

  • mkswap -L swap /dev/sdb2

    Why this is correct

    mkswap with -L sets a label and creates the swap signature.

  • mkfs.swap /dev/sdb2

    Why it's wrong here

    mkfs.swap is not a standard command.

About these practice questions

Courseiva writes every LPIC-2 question from scratch — 507 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 →

How Courseiva writes practice questions · Editorial policy

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.