A volume group named data_vg is 500 GiB in total size, of which 120 GiB is still unallocated. The logical volume /dev/data_vg/web_lv is 80 GiB, formatted with ext4, and mounted at /srv/web while the site is serving traffic. You are asked to grow the logical volume so that it consumes all of the free space in the VG and to expand the filesystem at the same time, without taking the web service offline or running a second command. Which command meets these requirements?
The lvextend utility can only enlarge a logical volume, and the -r (or --resizefs) option tells LVM to call fsadm so the mounted filesystem is grown in the same step. The size argument -l +100%FREE means "add all remaining free extents in the volume group," so the LV grows by exactly the 120 GiB that is available.
lvextend -l +100%FREE -r /dev/data_vg/web_lv therefore enlarges the LV by the VG's free space and immediately resizes the ext4 filesystem while it is online, satisfying every requirement.
lvextend -L 100%VG -r /dev/data_vg/web_lv attempts to set the LV's absolute size to the full 500 GiB of the VG, which would fail because only 120 GiB is free.
lvresize -l +100%FREE /dev/data_vg/web_lv && resize2fs /dev/data_vg/web_lv would work, but it still needs a second command to grow the filesystem, so it does not meet the "single-command" requirement.
lvreduce -L-120G -r /dev/data_vg/web_lv shrinks the LV instead of enlarging it, which is the opposite of what is required.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the -r option in the lvextend command?
Open an interactive chat with Bash
What does the -l +100%FREE argument mean in lvextend?
Open an interactive chat with Bash
Why is lvresize not an acceptable choice in this scenario?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access