Archive for the tag 'Volumes'

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.

# pvdisplay /dev/hda1

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
SBDavid

Resizing & Removing Physical Volumes

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.

# pvremove /dev/sdd5
SBDavid

Displaying Physical Volumes

Displaying Physical Volumes

There are three commands you can use to display properties of LVM physical volumes: pvs,pvdisplay, and pvscan.

The pvs command provides physical volume information in a configurable form, displaying one line per physical volume. The pvs command provides a great deal of format control, and is useful for scripting.

The pvdisplay command provides a verbose multi-line output for each physical volume. It displays physical properties (size, extents, volume group, etc.) in a fixed format.

The following example shows the output of the pvdisplay command for a single physical volume.

# pvdisplay
SBDavid

Snapshot Volumes

Snapshot Volumes

The LVM snapshot feature provides the ability to create virtual images of a device at a particular instant without causing a service interruption. When a change is made to the original device (the origin) after a snapshot is taken, the snapshot feature makes a copy of the changed data area as it was prior to the change so that it can reconstruct the state of the device.

LVM snapshots are not supported across the nodes in a cluster. You cannot create a snapshot
volume in a clustered volume group.

LVM snapshots are not supported for LVM mirrored logical volumes.

Snapshot copies of a file system are virtual copies, not actual media backup for a file system.
Snapshots do not provide a substitute for a backup procedure.

SBDavid

Striped Logical Volumes

Striped Logical Volumes

When you write data to an LVM logical volume, the file system lays the data out across the underlying physical volumes. You can control the way the data is written to the physical volumes by creating a striped logical volume.

For large sequential reads and writes, this can improve the efficiency of the data I/O.Striping enhances performance by writing data to a predetermined number of physical volumes in round-robin fashion. With striping, I/O can be done in parallel. In some situations, this can result in near-linear performance gain for each additional physical volume in the stripe.

Next »