14.13 Linux LVM Management Tools

LVM tools are available in the YaST Expert Partitioner and in native Linux command line commands.

14.13.1 Using the YaST Expert Partitioner

You can access the LVM tools in the YaST Expert Partitioner by using the desktop menus, or enter the following in a terminal console:

yast2 disk

For information about using the Partitioner, see LVM Configuration in the SLES 11 SP4: Storage Administration Guide.

14.13.2 Using LVM Commands

For information about using LVM commands, see the man pages for the commands described in Table 14-1. Perform the commands as the root user.

Table 14-1 LVM Commands

Command

Description

pvcreate <device>

Initializes a device (such as /dev/sdb) for use by LVLM as a physical volume.

pvdisplay <device>

Displays information about the LVM physical volume, such as whether it is currently being used in a logical volume.

vgcreate -c y <vg_name> <dev1> [dev2...]

Creates a clustered volume group with one or more specified devices.

vgchange -a [ey | n] <vg_name>

Activates (-a ey) or deactivates (-a n) a volume group and its logical volumes for input/output.

IMPORTANT:Ensure that you use the ey option to exclusively activate a volume group on a cluster node. This option is used by default in the load script.

vgremove <vg_name>

Removes a volume group. Before using this command, remove the logical volumes, then deactivate the volume group.

vgdisplay <vg_name>

Displays information about a specified volume group.

To find the total physical extent of a volume group, enter

vgdisplay vg_name | grep "Total PE"
lvcreate -L size -n <lv_name> <vg_name>

Creates a logical volume of the specified size.

lvremove</dev/vg_name/lv_name>

Removes a logical volume, such as /dev/vg_name/lv_name.

Before using this command, close the logical volume by dismounting it with the umount command.

vgextend <vg_name><device>

Adds a specified physical volume to an existing volume group

vgreduce <vg_name> <device>

Removes a specified physical volume from an existing volume group.

IMPORTANT:Ensure that the physical volume is not currently being used by a logical volume. If it is, you must move the data to another physical volume by using the pvmove command.

lvextend -L size</dev/vg_name/lv_name>

Extends the size of a specified logical volume. Afterwards, you must also expand the file system to take advantage of the newly available space.

lvreduce -L size </dev/vg_name/lv_name>

Reduces the size of a specified logical volume.

IMPORTANT:Ensure that you reduce the size of the file system first before shrinking the volume, otherwise you risk losing data.

lvrename </dev/vg_name/old_lv_name> </dev/vg_name/new_lv_name>

Renames an existing LVM logical volume in a volume group from the old volume name to the new volume name. It does not change the volume group name.