Activating and Deactivating Volume Groups
When you create a volume group it is, by default, activated. This means that the logical volumes in that group are accessible and subject to change.
There are various circumstances for which you need to make a volume group inactive and thus unknown to the kernel. To deactivate or activate a volume group, use the -a (–available) argument of the vgchange command.
The following example deactivates the volume group my_volume_group.
# vgchange -a n my_volume_group
If clustered locking is enabled, add āeā to activate or deactivate a volume group exclusively on one node or ālā to activate or/deactivate a volume group only on the local node. Logical volumes with single-host snapshots are always activated exclusively because they can only be used on one node at once.
Tags: Activating, Deactivating, Groups, Volume
vgchange - change attributes of a volume group
vgchange allows you to change the attributes of one or more volume groups. Its main purpose is to activate and deactivate VolumeGroupName, or all volume groups if none is specified. Only active volume groups are subject to changes and allow access to their logical volumes.
During volume group activation, if vgchange recognizes snapshot logical volumes which were dropped because they ran out of space, it displays a message informing the administrator that such snapshots should be removed.
EXAMPLES
To activate all known volume groups in the system:
To change the maximum number of logical volumes of inactive volume group vg00 to 128.
vgchange -l 128 /dev/vg00
Tags: attributes, change, Group, vgchange, Volume
Removing Physical Volumes from a Volume Group
To remove unused physical volumes from a volume group, use the vgreduce command. The vgreduce command shrinks a volume group’s capacity by removing one or more empty physical volumes. This frees those physical volumes to be used in different volume groups or to be removed from the system.
Before removing a physical volume from a volume group, you can make sure that the physical volume is not used by any logical volumes by using the pvdisplay command.
If the physical volume is still being used you will have to migrate the data to another physical volume using the pvmove command. Then use the vgreduce command to remove the physical volume:
The following command removes the physical volume /dev/hda1 from the volume group my_volume_group.
# vgreduce my_volume_group /dev/hda1
Tags: Group, Physical, Removing, Volume, Volumes
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.
# vgcreate vg1 /dev/sdd1 /dev/sde1
When physical volumes are used to create a volume group, its disk space is divided into 4MB extents, by default. This extent is the minimum amount by which the logical volume may be increased or decreased in size. Large numbers of extents will have no impact on I/O performance of the logical volume.
You can specify the extent size with the -s option to the vgcreate command if the default extent size is not suitable.
Tags: Creating, Groups, Volume
Resizing & Removing Physical Volumes
If you need to change the size of an underlying block device for any reason, use the pvresizecommand to update LVM with the new size. You can execute this command while LVM is using the physical volume.
If a device is no longer required for use by LVM, you can remove the LVM label with the pvremovecommand. 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.
Tags: Physical, Removing, Resizing, Volumes