CompTIA Linux+ (XK0-005) — Question 191
A systems administrator needs to extend the logical volume /dev/mapper/linux-root to use all available space in its volume group. The filesystem should be extended as well. Which of the following commands will allow the administrator to achieve this goal?
Answer options
- A. lvm pvresize -r -l100% /dev/mapper/linux-root
- B. lvchange -L100% /dev/mapper/linux-root
- C. lvextend -l+100% /dev/mapper/linux-root
- D. lvresize -l100%FREE -r /dev/mapper/linux-root
Correct answer: D
Explanation
The correct answer is D, as it extends the logical volume to use all free space and resizes the filesystem in one command. Option A is incorrect because it is intended for physical volumes, not logical volumes. Option B is wrong since it only changes the size without resizing the filesystem. Option C does not resize the filesystem, so it is not suitable for this requirement.