CompTIA Linux+ (XK0-006)System ManagementHard

A technician has three new, unpartitioned disks: /dev/sdb, /dev/sdc, and /dev/sdd. Which sequence of commands correctly initializes them for LVM, groups them into a single volume group named vg_data, and then creates a 50GB logical volume named lv_app?

  1. Avgcreate vg_data /dev/sdb /dev/sdc /dev/sdd && pvcreate vg_data && lvcreate -n lv_app -L 50G vg_data
  2. Bpvcreate /dev/sdb /dev/sdc /dev/sdd && vgcreate vg_data /dev/sdb /dev/sdc /dev/sdd && lvcreate -n lv_app -L 50G vg_data
  3. Clvcreate -n lv_app -L 50G /dev/sdb /dev/sdc /dev/sdd && vgcreate vg_data lv_app && pvcreate vg_data
  4. Dpvcreate vg_data && lvcreate -n lv_app -L 50G vg_data && vgcreate /dev/sdb /dev/sdc /dev/sdd
Show answer & explanation

Correct answer: B. pvcreate /dev/sdb /dev/sdc /dev/sdd && vgcreate vg_data /dev/sdb /dev/sdc /dev/sdd && lvcreate -n lv_app -L 50G vg_data

The correct LVM build order is: initialize each disk as a physical volume with pvcreate, combine those physical volumes into a volume group with vgcreate, then carve out a logical volume of the desired size from that group with lvcreate. Any other order fails because each command requires its predecessor's output to exist first.

Why the other options are wrong

  • A. vgcreate is run before pvcreate, but a volume group cannot be created from disks that are not yet physical volumes.
  • C. lvcreate is attempted directly on raw disks before any PV or VG exists, which is invalid.
  • D. pvcreate is given a VG name instead of disk devices, and the command order is reversed and invalid.

LVM Build Order

LVM is built in three layers: physical volumes (PVs) created from disks/partitions with pvcreate, grouped into a volume group with vgcreate, from which logical volumes are carved with lvcreate.

  • pvcreate initializes raw disks/partitions as PVs
  • vgcreate pools PVs into a VG
  • lvcreate allocates a sized LV from VG free space

Memory trick: 'Please Very Loudly: Pvcreate, Vgcreate, Lvcreate.'

More System Management questions