2.3. Creating LVM physical volume
This procedure describes how to create and label LVM physical volumes (PVs).
In this procedure, replace the /dev/vdb1, /dev/vdb2, and /dev/vdb3 with the available storage devices in your system.
Conditions préalables
-
The
lvm2package is installed.
Procédure
Create multiple physical volumes by using the space-delimited device names as arguments to the
pvcreatecommand:pvcreate /dev/vdb1 /dev/vdb2 /dev/vdb3
# pvcreate /dev/vdb1 /dev/vdb2 /dev/vdb3 Physical volume "/dev/vdb1" successfully created. Physical volume "/dev/vdb2" successfully created. Physical volume "/dev/vdb3" successfully created.Copy to Clipboard Copied! Toggle word wrap Toggle overflow This places a label on /dev/vdb1, /dev/vdb2, and /dev/vdb3, marking them as physical volumes belonging to LVM.
View the created physical volumes by using any one of the following commands as per your requirement:
The
pvdisplaycommand, which provides a verbose multi-line output for each physical volume. It displays physical properties, such as size, extents, volume group, and other options in a fixed format:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
pvscommand provides physical volume information in a configurable form, displaying one line per physical volume:pvs
# pvs PV VG Fmt Attr PSize PFree /dev/vdb1 lvm2 1020.00m 0 /dev/vdb2 lvm2 1020.00m 0 /dev/vdb3 lvm2 1020.00m 0Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
pvscancommand scans all supported LVM block devices in the system for physical volumes. You can define a filter in thelvm.conffile so that this command avoids scanning specific physical volumes:pvscan
# pvscan PV /dev/vdb1 lvm2 [1.00 GiB] PV /dev/vdb2 lvm2 [1.00 GiB] PV /dev/vdb3 lvm2 [1.00 GiB]Copy to Clipboard Copied! Toggle word wrap Toggle overflow