XK0-005 · Question #595
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…
The correct answer is D. lvresize -l100%FREE -r /dev/mapper/linux-root. To extend a logical volume to consume all available free space within its volume group and automatically resize the filesystem, a specific lvresize command is used.
Question
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?
Options
- Alvm pvresize -r -l100% /dev/mapper/linux-root
- Blvchange -L100% /dev/mapper/linux-root
- Clvextend -l+100% /dev/mapper/linux-root
- Dlvresize -l100%FREE -r /dev/mapper/linux-root
How the community answered
(34 responses)- A3% (1)
- B18% (6)
- C9% (3)
- D71% (24)
Why each option
To extend a logical volume to consume all available free space within its volume group and automatically resize the filesystem, a specific `lvresize` command is used.
`lvm pvresize` is used to resize physical volumes, not logical volumes, and the `-l100%` option used here is not standard for `pvresize` to refer to free space.
`lvchange` is used to change logical volume parameters like activation status or permissions, but not to extend its size using available free space.
`lvextend -l+100% /dev/mapper/linux-root` would attempt to extend the logical volume by 100% of its current size, not 100% of the free space in the volume group, and also lacks the `-r` option to resize the filesystem.
The `lvresize` command is used to resize logical volumes, and the `-l 100%FREE` option extends the LV to use all unallocated physical extents in the volume group. The `-r` option automatically resizes the filesystem on the logical volume after the LV itself has been extended, which is crucial for the space to be usable.
Concept tested: LVM logical volume and filesystem extension
Source: https://man7.org/linux/man-pages/man8/lvresize.8.html
Topics
Community Discussion
No community discussion yet for this question.