Courseiva
System Architecture →mediumMultiple Choice

LPIC-1 System Architecture Practice Question

Exhibit

Refer to the exhibit.

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 233.8G  0 disk
├─sda1   8:1    0   512M  0 part /boot
├─sda2   8:2    0   230G  0 part /
└─sda3   8:3    0   2.8G  0 part [SWAP]
sdb      8:16   0 931.5G  0 disk
└─sdb1   8:17   0 931.5G  0 part /data

The system administrator wants to add a new swap partition on /dev/sdb2. After creating the partition, which command should be used to initialize it as swap?

⚠ Common exam trap

Many exam-takers confuse `swapon` (which activates swap) with `mkswap` (which initializes it), mistakenly thinking `swapon` can both prepare and enable the swap area.

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 is specifically designed to initialize a partition or file as a swap area by writing a swap signature (UUID and swap superblock) to the device. After creating the partition, you must run `mkswap /dev/sdb2` to set it up for use as swap before activating it with `swapon`.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    mkfs.ext4 /dev/sdb2

    Why it's wrong here

    mkfs.ext4 writes an ext4 filesystem signature, not a swap signature, so the kernel will not recognise the partition as swap. It is the right tool when preparing a data partition for mounting, not for swap initialisation.

  • ✗

    fsck /dev/sdb2

    Why it's wrong here

    fsck checks and repairs an existing filesystem; it neither creates nor converts anything, and on a raw partition it finds no filesystem to inspect. It is correct for verifying integrity of an already-formatted volume, not for initialising swap.

  • ✓

    mkswap /dev/sdb2

    Why this is correct

    mkswap writes the swap signature and UUID onto /dev/sdb2, initialising the partition so the kernel can use it as swap space. This satisfies the requirement to prepare the newly created partition before swapon activates it or an /etc/fstab entry mounts it.

  • ✗

    swapon /dev/sdb2

    Why it's wrong here

    swapon activates an already-initialised swap area; it does not write the swap signature. mkswap performs that initialisation, so swapon alone fails on a raw partition. swapon is correct later, to enable swap already prepared with mkswap.

About these practice questions

This LPIC-1 question is part of Courseiva's 402-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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LPIC-1 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-1 exam.