CompTIA Linux+ (XK0-004) — Question 9
A junior administrator of a physical server receives log messages indicating the out-of-memory killer has been active. All memory slots are in use on the motherboard, but additional disk space is available. Space has been allocated for a swap file.
Which of the following should the administrator use to reduce the output of memory messages?
Answer options
- A. free : swapoff / swapfile ; swapon -a
- B. mkswap /swapfile; swapon ג€"a
- C. fallocate ג€"l 2G /swapfile && swapon ג€"a
- D. echo ג€1ג€ > /proc/meninfo ; swapon / swapfile
Correct answer: B
Explanation
The correct answer is B, as using 'mkswap' creates a swap area on the specified file and 'swapon -a' enables it, effectively increasing the available virtual memory. Option A is incorrect because it attempts to free swap space without creating a new swap file. Option C is incorrect since it allocates space but does not create a swap area properly. Option D incorrectly modifies the memory information instead of addressing swap space.