You have just run `mkswap /dev/sdb2`. Which command makes the kernel start using that swap area immediately, without a reboot?
LPIC-1 Exam 101-500, objective 104. Devices, Linux filesystems, filesystem hierarchy standard easy
Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.
It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.
The options
Not correct free -h
Wrong. free only reports memory and swap usage. It is how you would confirm the new swap appeared, not how you enable it.
Not correct mount -t swap /dev/sdb2 /swap
Wrong. Swap is never mounted into the directory tree; it has no files and no mount point. The fstab entry for swap uses the mount point `none` or `swap` precisely because there is nothing to mount.
Not correct swapoff /dev/sdb2
Wrong, and the opposite. swapoff deactivates a swap area and pages its contents back into RAM.
Correct swapon /dev/sdb2
Correct. swapon activates a prepared swap area for the running kernel. `swapon -a` activates every swap entry listed in /etc/fstab instead.
Why
Swap setup is two steps: mkswap writes the swap signature and UUID onto the partition or file, then swapon tells the running kernel to use it. To make it survive a reboot you also add a line to /etc/fstab with type `swap` and option `defaults` or `sw`.
Where this comes from
- Cited
- LPI exam objective 104.1
- What it says
- Set up and use swap space with mkswap and swapon.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 104 and space the ones you get wrong.