Linux+ Logical Volume Management (LVM) Flashcards
6 cards from real Linux practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Linux+ Logical Volume Management (LVM) flashcards as text
In the Logical Volume Management (LVM) hierarchy, which component serves as a pool of storage created from one or more Physical Volumes, from which Logical Volumes are then allocated?
Answer: Volume Group (VG)
A Volume Group (VG) is a fundamental LVM component that pools one or more Physical Volumes (PVs) together, creating a single storage pool from which Logical Volumes (LVs) can be created.
A system administrator needs to shrink a logical volume named `/dev/datavg/archives` from 100G to 80G. What is the most critical prerequisite step that MUST be performed *before* running the `lvreduce` command?
Answer: Resize the filesystem on the logical volume to be smaller than or equal to 80G.
It is critical to shrink the filesystem (e.g., using `resize2fs` for ext4) before shrinking the logical volume. Failure to do so will result in data loss, as the `lvreduce` command will cut off the end of the volume, destroying any filesystem data that resides in that space.
A new disk, `/dev/sdd`, has been added to a server. A Linux administrator needs to add this disk's capacity to an existing Volume Group named `vg_data`. Which sequence of commands is the correct way to accomplish this?
Answer: 1. `pvcreate /dev/sdd` 2. `vgextend vg_data /dev/sdd`
The correct procedure is to first initialize the disk as a Physical Volume (PV) using `pvcreate`. Once the disk is prepared for LVM, it can then be added to an existing Volume Group (VG) using the `vgextend` command.
Which of the following commands is used to create a 5GB point-in-time snapshot named `webapp_backup` for the logical volume `/dev/vg_apps/lv_webapp`?
Answer: `lvcreate -s -L 5G -n webapp_backup /dev/vg_apps/lv_webapp`
The `lvcreate` command is used for creating logical volumes, and the `-s` or `--snapshot` option specifically designates the new LV as a snapshot of an existing origin LV. The `-L` option sets the size, and `-n` provides the name.
A logical volume `/dev/vg01/lv_logs` is full. The volume group `vg01` has 20GB of free space. Which command will extend the logical volume to use all available free space in the volume group and resize its ext4 filesystem in a single operation?
Answer: `lvextend -l +100%FREE -r /dev/vg01/lv_logs`
The `lvextend` command with the `-l +100%FREE` option tells LVM to allocate all remaining free extents in the volume group to the specified logical volume. The `-r` or `--resizefs` option then automatically resizes the filesystem to fill the newly enlarged volume, making it a convenient single-step operation.
Which command would you use to display a detailed, multi-line report of the attributes for a specific Physical Volume, such as `/dev/sda2`?
Answer: `pvdisplay /dev/sda2`
The `pvdisplay` command provides detailed, verbose information about a Physical Volume, including its name, the VG it belongs to, its size, PE size, and UUID. In contrast, `pvs` provides a brief, one-line summary.