HPlogo HP-UX Reference Volume 5 of 5 > l

lvm(7)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

lvm — Logical Volume Manager (LVM)

DESCRIPTION

The Logical Volume Manager (LVM) is a subsystem for managing disk space. The HP LVM subsystem offers value-added features, such as mirroring (with the optional HP MirrorDisk/UX software), high availability (with the optional HP ServiceGuard software), and striping, that enhance availability and performance.

Unlike earlier arrangements where disks were divided into fixed-sized sections, LVM allows the user to consider the disks, also known as physical volumes, as a pool (or volume) of data storage, consisting of equal-sized extents. The default size of an extent is 4 MB.

An LVM system consists of arbitrary groupings of physical volumes, organized into volume groups. A volume group can consist of one or more physical volumes. There can be more than one volume group in the system. Once created, the volume group, and not the disk, is the basic unit of data storage. Thus, whereas earlier one would move disks from one system to another, with LVM, one would move a volume group from one system to another. For this reason it is often convenient to have multiple volume groups on a system.

Volume groups can be subdivided into virtual disks, called logical volumes. A logical volume can span a number of physical volumes or represent only a portion of one physical volume. The pool of disk space that is represented by a volume group can be apportioned into logical volumes of various sizes. The size of a logical volume is determined by its number of extents. Once created, logical volumes can be treated just like disk partitions. Logical volumes can be assigned to file systems, used as swap or dump devices, or used for raw access.

Commands

LVM information can be created, displayed, and manipulated with the following commands:

lvchange

Change logical volume characteristics

lvcreate

Stripe, create logical volume in volume group

lvdisplay

Display information about logical volumes

lvextend

Increase space, increase mirrors for logical volume

lvlnboot

Prepare logical volume to be root, primary swap, or dump volume

lvmmigrate

Prepare root file system for migration from partitions to logical volumes

lvreduce

Decrease number of physical extents allocated to logical volume

lvremove

Remove one or more logical volumes from volume group

lvrmboot

Remove logical volume link to root, primary swap, or dump volume

pvchange

Change characteristics of physical volume in volume group

pvcreate

Create physical volume for use in volume group

pvdisplay

Display information about physical volumes within volume group

pvmove

Move allocated physical extents from one physical volume to other physical volumes

vgcfgbackup

Create or update volume group configuration backup file

vgcfgrestore

Display or restore volume group configuration from backup file

vgchange

Set volume group availability

vgcreate

Create volume group

vgdisplay

Display information about volume groups

vgexport

Export an volume group and its associated logical volumes

vgextend

Extend an volume group by adding physical volumes

vgimport

Import an volume group onto the system

vgreduce

Remove physical volumes from an volume group

vgremove

Remove volume group definition from the system

vgscan

Scan physical volumes for volume groups

The following commands are also available if the HP MirrorDisk/UX software is installed:

lvmerge

Merge two logical volumes into one logical volume

lvsplit

Split mirrored logical volume into two logical volumes

lvsync

Synchronize stale mirrors in logical volumes

vgsync

Synchronize stale logical volume mirrors in volume groups

EXAMPLES

The basic steps to take to begin using LVM are as follows:

  • Identify the disks to be used for LVM.

  • Create an LVM data structure on each identified disk (see pvcreate(1M)).

  • Collect all the physical volumes to form a new volume group (see vgcreate(1M)).

  • Create logical volumes from the space in the volume group (see lvcreate(1M)).

  • Use each logical volume as if it were a disk section (create a file system, or use for raw access).

To configure disk /dev/dsk/c0t0d0 as part of a new volume group named vg01.

  • First, initialize the disk for LVM with the pvcreate command.

    pvcreate /dev/rdsk/c0t0d0

  • Then, create the pseudo device file that is used by the LVM subsystem.

    mkdir /dev/vg01 mknod /dev/vg01/group c 64 0x030000

  • The minor number for the group file should be unique among all the volume groups on the system. It has the format 0xNN0000, where NN ranges from 00 to 09. The maximum value of NN is controlled by the kernel tunable parameter, maxvgs.

  • Create the volume group, vg01, containing the physical volume, /dev/dsk/c0t0d0, with the vgcreate command.

    vgcreate /dev/vg01 /dev/dsk/c0t0d0

  • You can view information about the newly created volume group with the vgdisplay command.

    vgdisplay -v /dev/vg01

  • Create a logical volume of size 100 MB, named usrvol, on this volume group with the lvcreate command.

    lvcreate -L 100 -n usrvol /dev/vg01

  • This creates two device files for the logical volume, /dev/vg01/usrvol, which is the block device file, and /dev/vg01/rusrvol, which is the character (raw) device file.

  • You can view information about the newly created logical volume with the lvdisplay command.

    lvdisplay /dev/vg01/lvol1

  • Any operation allowed on a disk partition is allowed on the logical volume. Thus, you can use usrvol to hold a file system.

    newfs /dev/vg01/rusrvol hp7937 mount /dev/vg01/usrvol /usr

SEE ALSO

lvchange(1M), lvcreate(1M), lvdisplay(1M), lvextend(1M), lvlnboot(1M), lvreduce(1M), lvremove(1M), lvrmboot(1M), pvchange(1M), pvcreate(1M), pvdisplay(1M), pvmove(1M), vgcfgbackup(1M), vgcfgrestore(1M), vgchange(1M), vgcreate(1M), vgdisplay(1M), vgexport(1M), vgextend(1M), vgimport(1M), vgreduce(1M), vgremove(1M), vgscan(1M).

Managing Systems and Workgroups.

If HP MirrorDisk/UX is installed: lvmerge(1M), lvsplit(1M), lvsync(1M), vgsync(1M).

If HP ServiceGuard is installed: cmcheckconf(1M), cmquerycl(1M), Managing MC/ServiceGuard.

© Hewlett-Packard Development Company, L.P.