lvcreate(1M) lvcreate(1M)
NAME [Toc] [Back]
lvcreate - create logical volume in LVM volume group
SYNOPSIS [Toc] [Back]
/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 [Toc] [Back]
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.
Logical volumes that were created using the striped option are not
supported in shared mode.
DESCRIPTION [Toc] [Back]
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 [Toc] [Back]
The -c, -d, -m, -M, and -s options are only meaningful if the optional
HP MirrorDisk/UX software has been installed on the system.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
lvcreate(1M) lvcreate(1M)
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.
-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,
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
lvcreate(1M) lvcreate(1M)
+ 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.
-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
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
lvcreate(1M) lvcreate(1M)
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. -i and -I must be
specified together.
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003
lvcreate(1M) lvcreate(1M)
-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. -i and -I must be
specified together.
-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
Hewlett-Packard Company - 5 - HP-UX 11i Version 2: August 2003
lvcreate(1M) lvcreate(1M)
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 readwrite.
This is the default.
r Set the access permission to readonly.
-r relocate Set the bad block relocation policy.
relocate can have one of the following
values:
y Allow bad block relocation. Upon a
media failure (detection of a bad
block of data on disk), LVM will
mark the failed block in the Bad
Block Directory, and attempt to
relocate the block to a new
location on disk. If relocation is
successful then no error will be
returned, and future I/O requests
which contain the bad block will be
directed to the new location. If
relocation is unsuccessful, an I/O
error will be returned, and
subsequent I/O requests containing
the bad block will again attempt
relocation. This is the default.
n Prevent bad block relocation. Upon
a media failure, LVM will mark the
failed block as bad in the Bad
Block Directory, but will NOT
Hewlett-Packard Company - 6 - HP-UX 11i Version 2: August 2003
lvcreate(1M) lvcreate(1M)
attempt to relocate the bad block
to a new location on disk. Future
I/O requests which contain the bad
block will return with an I/O
error. No attempt will be made to
access the bad block.
N Disable bad block relocation and
the Bad Block Directory. Upon a
media failure, LVM will NOT attempt
to relocate the bad block. In
addition it will NOT enter the
block in the Bad Block Directory.
LVM will have no record of the
block being bad, and will attempt
to access it on future I/O
requests.
-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 volumes are only allocated using the strict or PVG-
strict allocation policies. The number of extents for a striped
logical volume is always a multiple of the number of disks the logical
volume is striped across. A logical volume striped across n disks, is
allocated in sets of n extents, and each extent of a given set is
allocated on a different physical volumes in the volume group.
Hewlett-Packard Company - 7 - HP-UX 11i Version 2: August 2003
lvcreate(1M) lvcreate(1M)
EXTERNAL INFLUENCES [Toc] [Back]
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 [Toc] [Back]
Create a logical volume in volume group /dev/vg02:
lvcreate /dev/vg02
Create a logical volume in volume group /dev/vg03 with nonstrict
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
Distributed Allocation Policy [Toc] [Back]
This example shows how the -D y option can be used to create EXTENTBASED
MIRRORED STRIPES.
Assume that volume group /dev/vgtest has two physical volume groups:
pvg1, 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 EXTENTBASED
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.
Hewlett-Packard Company - 8 - HP-UX 11i Version 2: August 2003
lvcreate(1M) lvcreate(1M)
+ 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 [Toc] [Back]
The root, swap, and dump logical volumes (see lvlnboot(1M)) must be
created with contiguous allocation policy.
SEE ALSO [Toc] [Back]
lvchange(1M), lvdisplay(1M), lvextend(1M), lvreduce(1M), pvchange(1M).
Hewlett-Packard Company - 9 - HP-UX 11i Version 2: August 2003 [ Back ] |