A system administrator needs to add a new 10GB disk to an existing volume group 'vgdata' to extend logical volumes. Which of the following is the correct sequence of commands?
Trap 1: vgextend vgdata /dev/sdb, pvcreate /dev/sdb, lvextend
Running vgextend before pvcreate fails because LVM cannot add a device that lacks a valid physical volume label to a volume group. pvcreate writes the indispensable metadata header that identifies /dev/sdb as an LVM PV; without it, vgextend reports the device as not found or not a physical volume. The correct sequence is to initialize the disk first, then join it to the volume group, and only then extend any LV.
Trap 2: pvcreate /dev/sdb, lvextend, vgextend vgdata /dev/sdb
After pvcreate, /dev/sdb is a physical volume but it has not yet been added to vgdata, so the volume group has no new free extents available. An lvextend attempt at this point will fail because the LV's volume group cannot allocate from a PV that is not a member. The vgextend must occur before lvextend to make that free space visible to the logical volume being expanded.
Trap 3: lvextend, vgextend vgdata /dev/sdb, pvcreate /dev/sdb
Because lvextend is executed first, it looks for free extents in vgdata before any new disk has been prepared or added, so it cannot find space and aborts. vgextend after that would add /dev/sdb to the VG, but the LV extension already failed, and pvcreate last would merely initialize the disk after the operations that needed it had run. This order violates every dependency in the LVM workflow and cannot succeed.
- A
pvcreate /dev/sdb, vgextend vgdata /dev/sdb, lvextend
pvcreate initializes /dev/sdb with LVM metadata, making it a physical volume that LVM can recognize. vgextend then adds that PV to the existing volume group vgdata, increasing its total allocatable space. Only after the VG has free physical extents can lvextend allocate from them to grow a logical volume, followed by a filesystem resize if needed. This dependency chain makes the order mandatory.
- B
vgextend vgdata /dev/sdb, pvcreate /dev/sdb, lvextend
Why wrong: Running vgextend before pvcreate fails because LVM cannot add a device that lacks a valid physical volume label to a volume group. pvcreate writes the indispensable metadata header that identifies /dev/sdb as an LVM PV; without it, vgextend reports the device as not found or not a physical volume. The correct sequence is to initialize the disk first, then join it to the volume group, and only then extend any LV.
- C
pvcreate /dev/sdb, lvextend, vgextend vgdata /dev/sdb
Why wrong: After pvcreate, /dev/sdb is a physical volume but it has not yet been added to vgdata, so the volume group has no new free extents available. An lvextend attempt at this point will fail because the LV's volume group cannot allocate from a PV that is not a member. The vgextend must occur before lvextend to make that free space visible to the logical volume being expanded.
- D
lvextend, vgextend vgdata /dev/sdb, pvcreate /dev/sdb
Why wrong: Because lvextend is executed first, it looks for free extents in vgdata before any new disk has been prepared or added, so it cannot find space and aborts. vgextend after that would add /dev/sdb to the VG, but the LV extension already failed, and pvcreate last would merely initialize the disk after the operations that needed it had run. This order violates every dependency in the LVM workflow and cannot succeed.