Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > L

lvcreate(1M)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

lvcreate — create logical volume in LVM volume group

SYNOPSIS

/usr/sbin/lvcreate [-A autobackup] [-c mirror_consistency] [-C contiguous] [-d schedule] [-D distributed] [-i stripes [-I stripe_size]] [-l le_number | -L lv_size] [-m mirror_copies] [-M mirror_write_cache] [-n lv_name] [-p permission] [-r relocate] [-s strict] vg_name

Remarks

Mirrored disk operations require the installation of the optional HP MirrorDisk/UX software, which is not included in the standard HP-UX operating system.

lvcreate cannot be performed if the volume group is activated in shared mode.

DESCRIPTION

The lvcreate command creates a new logical volume within the volume group specified by vg_name. Up to 255 logical volumes can be created in one volume group.

If you specify the -n lv_name option, a new logical volume is created with that name. Otherwise, a system-generated name of the form lvolN is created, where N is the decimal equivalent of the two least significant bytes of the minor number of the new logical volume, in the range 1 to 255 (see lvm(7)). Two device files are created in vg_name: a block device file named lv_name or lvolN, and a character (raw) device file named rlv_name or rlvolN.

If you omit the -l and -L options, the logical volume is created with zero length. This permits you to choose its physical volume location when you allocate logical extents with the lvextend command (see lvextend(1M)). If you specify -l or -L, the location is determined automatically.

The default settings provide the most commonly used characteristics. Use the options to tailor the logical volume to the requirements of the system. Once a logical volume is created, some of its characteristics can be changed with the lvchange, lvextend, and lvreduce commands (see lvchange(1M), lvextend(1M), and lvreduce(1M)).

Options and Arguments

The -c, -d, -m, -M, and -s options are only meaningful if the optional HP MirrorDisk/UX software has been installed on the system.

lvcreate recognizes the following options and arguments:

vg_name

The path name of a volume group.

-A autobackup

Set automatic backup for this invocation of this command. autobackup can have one of the following values:

y

Automatically back up configuration changes made to the logical volume. This is the default.

After this command executes, the vgcfgbackup command (see vgcfgbackup(1M)) is executed for the volume group to which the logical volume belongs.

n

Do not back up configuration changes this time.

-c mirror_consistency

Set mirror consistency recovery. This option is effective only when -M n is specified. It is ignored for -M y. mirror_consistency can have one of the following values:

y

Set mirror consistency recovery on. This is the default.

LVM achieves mirror consistency during volume group activation by going through all logical extents and copying data from a nonstale copy to the other mirror copies.

n

Set mirror consistency recovery off. LVM does not perform mirror consistency recovery on this logical volume when the volume group is activated following a system crash. This setting should only be used on logical volumes that do not require mirror consistency recovery or where mirror consistency recovery is performed by another subsystem; for example swap. See the WARNINGS section for more details.

-C contiguous

Set the contiguous allocation policy. A contiguous logical volume has three characteristics:

  • Physical extents are allocated in ascending order,

  • No gap is allowed between physical extents within a mirror copy,

  • Physical extents of any mirror copy all reside on a single physical volume.

Use the strict (-s) and contiguous (-C) options together to form various combined allocation policies on a logical volume. For example, -s y -C y defines a logical volume such that each mirror copy is contiguous, yet mirror copies of a logical extent cannot share the same physical volume.

contiguous can have one of the following values:

y

Set a contiguous allocation policy.

n

Do not set a contiguous allocation policy. This is the default.

The enforcement of a contiguous allocation policy via the -C y option is not supported on a striped logical volume.

-d schedule

Set the scheduling policy when a logical extent with more than one mirror is written. (The scheduling policy of a striped logical volume is striped and cannot be changed.) schedule can have one of the following values:

p

Establish a parallel scheduling policy. This is the default.

s

Establish a sequential scheduling policy. Use this value with care, because it leads to performance loss in most cases.

-D distributed

Set the distributed allocation policy. distributed can have one of the following values:

y

Turn on distributed allocation.

n

Turn off distributed allocation. This is the default.

When the distributed allocation policy is turned on, only one free extent is allocated from the first available physical volume. The next free extent is allocated from the next available physical volume. Allocation of free extents proceeds in round-robin order on the list of available physical volumes.

When the distributed allocation policy is turned off, all available free extents are allocated from each available physical volume before proceeding to the next available physical volume. This is the default.

The distributed allocation policy REQUIRES the PVG-strict allocation policy (-s g) to ensure that mirrors of distributed extents do not overlap (for maximum availability).

lvcreate(1M) will obtain the list of available physical volumes from /etc/lvmpvg. See vgextend(1M) for more information on physical volume groups and /etc/lvmpvg.

When a logical volume with distributed extents is mirrored, the resulting layout is commonly referred to as EXTENT-BASED MIRRORED STRIPES.

Note that EXTENT-BASED MIRRORED STRIPES can be created without the distributed allocation policy by adding one extent at a time to the desired physical volumes through lvextend(1M).

The distributed allocation policy is incompatible with the striped scheduling policy (-i stripes) and the contiguous allocation policy (-C y).

The lvchange(1M) command can be used to assign the distributed allocation policy to an existing logical volume.

See lvdisplay(1M) for display values.

See EXAMPLES.

-i stripes

Set the number of disks to stripe across. stripes must be in the range 2 to the number of disks in the current volume group. If -i is provided and -I is not, the stripe size is set to 8 kilobytes.

-I stripe_size

Set the size in kilobytes of the stripe. stripe_size should be a power of 2 in the range 4 to 32768. If -I is provided and -i is not, the command will fail and return an error. Stripe size should be a value less than or equal to physical extent size and must be specified with the -i option.

-l le_number

Allocate space to the logical volume, specified in logical extents. le_number is a decimal value in the range 1 to 65535 (the implementation limit). The default is described above.

Either -l or -L can be specified, but not both.

-L lv_size

Allocate space to the logical volume, specified in megabytes. lv_size is a decimal value in the range 1 to 16777216 (the implementation limit). lv_size is rounded up to the nearest multiple of the logical extent size, equivalent to the physical extent size defined for the volume group by the vgcreate command (see vgcreate(1M)). The default is described above.

Either the -l or the -L option can be specified, but not both.

-m mirror_copies

Set the number of mirror copies allocated for each logical extent. A mirror copy contains the same data as the original. mirror_copies can have the value 1 or 2. The default value is 0 (no mirror copies).

-M mirror_write_cache

Set the Mirror Write Cache flag. mirror_write_cache can have one of the following values:

y

Set Mirror Write Cache on. This is the default.

Every write to a mirror copy is recorded in the Mirror Write Cache. The Mirror Consistency Record in the Volume Group Reserved Area on the disk is updated whenever there is a write to a logical track group that is not already recorded in the cache. This allows LVM to determine whether all the mirror copies are identical, even across system crashes. When the volume group is activated, the Mirror Consistency Record is used to perform mirror consistency recovery.

n

Set Mirror Write Cache to off. Mirror write does not incur an additional write to the Mirror Consistency Record.

-n lv_name

Set the name of the new logical volume to lv_name, where lv_name is a simple file name, not a path name. The default is described above.

-p permission

Set the access permission. permission can have one of the following values:

w

Set the access permission to read-write. This is the default.

r

Set the access permission to read-only.

-r relocate

Set the logical volume bad block relocation policy. This is an obsolete flag available only to provide compatibility with prior HP-UX releases. The relocate flag can have one of the following values:

y|n|N

This release does not provide the LVM bad block relocation feature; but for compatibility reasons, the value is maintained as a logical volume attribute. Displaying the logical volume attributes will show the value of the flag selected. However, regardless of the selection, no new relocations will be done.

If the volume group is activated on a different HP-UX release that provides the bad block relocation feature, bad blocks may be relocated depending upon the value of this flag. Although no new relocations will be done, any bad block relocations present on a logical volume (activated on HP-UX releases that provided this feature) will be honored when the volume group is activated on this HP-UX release.

y is the default value of this flag.

-s strict

Set the strict allocation policy. Mirror copies of a logical extent can be allocated to share or not share the same physical volume or physical volume group. strict can have one of the following values:

y

Set a strict allocation policy. Mirrors of a logical extent cannot share the same physical volume. This is the default.

g

Set a PVG-strict allocation policy. Mirrors of a logical extent cannot share the same physical volume group. A PVG-strict allocation policy cannot be set on a logical volume in a volume group that does not have a physical volume group defined.

n

Do not set a strict or PVG-strict allocation policy. Mirrors of a logical extent can share the same physical volume.

Striped Logical Volume considerations

Striped and mirrored logical volumes are supported. A logical volume striped across stripes physical volumes is allocated in sets of stripes logical extents. A set corresponds to stripes physical extents if the volume is not mirrored or to stripes * (mirror_copies + 1) physical extents if the volume is mirrored. stripes is the number of physical volumes the logical volume is striped across. It is set with the option -i stripes. mirror_copies is the number of mirror copies allocated for each logical extent. It is set with the -m option. The user data is striped across stripes physical extents of the set, and each of these extents is mirrored on mirror_copies other physical extents of the same set. Striped logical volumes are only allocated using the strict or PVG-strict allocation policies. Each physical extent of a given set is allocated on a different physical volume in the volume group.

The total number of physical extents of a striped logical volume is always a multiple of stripes (or stripes * (mirror_copies + 1) if the volume is mirrored).

A minimum of stripes (or stripes * (mirror_copies + 1) if the volume is mirrored) physical volumes with adequate free space and meeting the allocation policy is needed to allocate a striped logical volume.

pvmove cannot move extents of a striped logical volume.

EXTERNAL INFLUENCES

Environment Variables

LANG determines the language in which messages are displayed.

If LANG is not specified or is null, it defaults to "C" (see lang(5)).

If any internationalization variable contains an invalid setting, all internationalization variables default to "C" (see environ(5)).

EXAMPLES

Create a logical volume in volume group /dev/vg02:

lvcreate /dev/vg02

Create a logical volume in volume group /dev/vg03 with non-strict allocation policy:

lvcreate -s n /dev/vg03

Create a logical volume of size 100 MB in volume group /dev/vg03:

lvcreate -L 100 /dev/vg03

Create a logical volume of size 90 MB striped across 3 disks with a stripe size of 64 KB:

lvcreate -L 90 -i 3 -I 64 /dev/vg03

Create a logical volume of size 90 MB striped across 3 disks with one mirror copy and a stripe size of 64 KB:

lvcreate -L 90 -i 3 -I 64 -m 1 /dev/vg03

Distributed Allocation Policy

This example shows how the -D y option can be used to create EXTENT-BASED MIRRORED STRIPES.

Assume that volume group /dev/vgtest has two physical volume groups: pvg1 and pvg2.

Assume that each physical volume group has 2 physical volumes.

Assume that the first physical volume in each pvg has 3 extents free and the second physical volume in each pvg has 2 extents free.

The following command creates a logical volume in vgtest with EXTENT-BASED MIRRORED STRIPES:

lvcreate -D y -s g -m 1 -l 5 /dev/vgtest

The distributed allocation proceeds as follows:

  • A free extent is allocated from the 1st pvol in pvg1.

  • A free extent is allocated from the 2nd pvol in pvg1.

  • A free extent is allocated from the 1st pvol in pvg1.

  • A free extent is allocated from the 2nd pvol in pvg1.

  • A free extent is allocated from the 1st pvol in pvg1.

  • Mirrors for the five extents are then allocated from the free extents in pvg2 in a similar manner.

WARNINGS

The root, swap, and dump logical volumes (see lvlnboot(1M)) must be created with contiguous allocation policy.

The creation of striped and mirrored logical volume(s) may prevent the import and activation of the volume group on an earlier HP-UX release. See lvcreate(1M) on the earlier release to see if it explicitly states that striping and mirroring is supported. If the striped and mirrored logical volumes of the volume group are removed or un-mirrored, the volume group becomes again compatible with the older HP-UX releases.

By setting mirror consistency recovery off, crash recovery time will be reduced. After a system crash the mirrored logical volume will be available, but there may not be consistent data across each mirror copy. The only types of data that can safely be put on a mirrored logical volume with mirror consistency recovery turned off are:

  • data not needed after a crash, such as swap or other raw scratch data, or

  • data that an application itself will automatically reconstruct; for example, a raw logical volume for which a database keeps a log of incomplete transactions.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.