CompTIA Linux+ (XK0-006)System ManagementHard
A volume group 'vg_data' has run out of free space. A technician adds a new physical disk, partitions it as /dev/sdd1, and initializes it as a physical volume with 'pvcreate /dev/sdd1'. Which command should be run next to add this new physical volume's space into the existing volume group so it can be used to extend a logical volume?
- Alvextend -L +50G /dev/vg_data/lv_data
- Bpvcreate vg_data /dev/sdd1
- Cvgextend vg_data /dev/sdd1
- Dvgcreate vg_data /dev/sdd1
Show answer & explanationAnswer & explanation
Correct answer: C. vgextend vg_data /dev/sdd1
'vgextend' adds an already-initialized physical volume to an existing volume group, increasing the pool of space available for logical volumes. 'lvextend' would grow a logical volume but only after the volume group itself has more free space, 'pvcreate' was already run and takes a device not a VG name, and 'vgcreate' creates a brand-new volume group rather than extending an existing one.
Why the other options are wrong
- A. Extends a logical volume, but the VG must first have the extra space available.
- B. pvcreate initializes a device as a PV; running it again on the VG name is invalid syntax.
- D. Creates a brand-new volume group, which would fail since vg_data already exists.
vgextend
LVM command that adds one or more physical volumes to an existing volume group, increasing its total available storage pool.
- Requires the PV to already be initialized with pvcreate
- Must run before lvextend can use the new space
- Reverse operation is vgreduce to remove a PV from a VG
Memory trick: vgextend feeds the pool before lvextend can drink from it.