Installation guide

Preventing Allocation on a Physical Volume
25
You can define a filter in the lvm.conf so that this command will avoid scanning specific physical
volumes. For information on using filters to control which devices are scanned, see Section 4.5,
“Controlling LVM Device Scans with Filters”.
4.2.3. Preventing Allocation on a Physical Volume
You can prevent allocation of physical extents on the free space of one or more physical volumes with
the pvchange command. This may be necessary if there are disk errors, or if you will be removing the
physical volume.
The following command disallows the allocation of physical extents on /dev/sdk1.
# pvchange -x n /dev/sdk1
You can also use the -xy arguments of the pvchange command to allow allocation where it had
previously been disallowed.
4.2.4. Resizing a Physical Volume
If you need to change the size of an underlying block device for any reason, use the pvresize
command to update LVM with the new size. You can execute this command while LVM is using the
physical volume.
4.2.5. Removing Physical Volumes
If a device is no longer required for use by LVM, you can remove the LVM label with the pvremove
command. Executing the pvremove command zeroes the LVM metadata on an empty physical
volume.
If the physical volume you want to remove is currently part of a volume group, you must remove it from
the volume group with the vgreduce command, as described in Section 4.3.6, “Removing Physical
Volumes from a Volume Group”.
# pvremove /dev/ram15
Labels on physical volume "/dev/ram15" successfully wiped
4.3. Volume Group Administration
This section describes the commands that perform the various aspects of volume group
administration.
4.3.1. Creating Volume Groups
To create a volume group from one or more physical volumes, use the vgcreate command. The
vgcreate command creates a new volume group by name and adds at least one physical volume to
it.
The following command creates a volume group named vg1 that contains physical volumes /dev/
sdd1 and /dev/sde1.