Linux+ Linux+ Logical Volume Management (LVM) 2 — Questions and Answers
Question 1: Which command reduces the size of a logical volume named /dev/vg0/lv_data by 5GB?
- lvreduce -L -5G /dev/vg0/lv_data (Correct answer)
- lvresize -L -5G /dev/vg0/lv_data
- lvchange -L -5G /dev/vg0/lv_data
- lvshrink -L 5G /dev/vg0/lv_data
Correct answer: lvreduce -L -5G /dev/vg0/lv_data
lvreduce reduces the size of a logical volume, using -L with a negative value to specify the reduction amount.
Question 2: What must be done before shrinking an ext4 filesystem on a logical volume?
- Unmount the filesystem and run resize2fs first (Correct answer)
- Run fsck only while the filesystem is mounted
- Use lvreduce before any filesystem operation
- Convert the filesystem to XFS before shrinking
Correct answer: Unmount the filesystem and run resize2fs first
The filesystem must be unmounted and resized with resize2fs before shrinking the logical volume to prevent data corruption.
Question 3: Which LVM metadata backup file location is used by default for vgcfgbackup?
- /etc/lvm/backup/ (Correct answer)
- /var/lvm/backup/
- /boot/lvm/
- /lib/lvm/config/
Correct answer: /etc/lvm/backup/
LVM stores volume group configuration backups in /etc/lvm/backup/ by default when vgcfgbackup is run.
Question 4: A volume group has 100 extents free. What does 'lvcreate -l 50%FREE vg0 -n lv_new' create?
- A logical volume using 50 extents (Correct answer)
- A logical volume using 50% of total VG size
- A logical volume using 50 MB
- A logical volume using 50% of used extents
Correct answer: A logical volume using 50 extents
The %FREE suffix calculates 50% of the currently free extents (100), creating a volume using 50 extents.
Question 5: Which command displays detailed information about a specific logical volume including its segments?
- lvdisplay -m /dev/vg0/lv1 (Correct answer)
- lvshow --segments /dev/vg0/lv1
- lvinfo -s /dev/vg0/lv1
- lvscan --detail /dev/vg0/lv1
Correct answer: lvdisplay -m /dev/vg0/lv1
lvdisplay -m (or --maps) shows logical volume segment mapping details including physical extents.
Question 6: What is the purpose of the 'vgscan' command?
- Scans all block devices for LVM volume groups and updates the LVM cache (Correct answer)
- Creates a new scan report of VG free space
- Validates VG metadata integrity
- Removes stale VG entries from the system
Correct answer: Scans all block devices for LVM volume groups and updates the LVM cache
vgscan scans all block devices to detect volume groups and updates the LVM device cache (/run/lvm/cache/.cache).
Question 7: Which option in lvcreate creates a thinly-provisioned logical volume inside a thin pool?
- --virtualsize (Correct answer)
- --thinsize
- --sparse
- --preallocate
Correct answer: --virtualsize
The --virtualsize (or -V) option specifies the virtual size of a thin volume backed by a thin pool.
Which command reduces the size of a logical volume named /dev/vg0/lv_data by 5GB?