lvcreate(1M)															      lvcreate(1M)

NAME
lvcreate - create logical volume in LVM volume group SYNOPSIS
autobackup] mirror_consistency] contiguous] schedule] distributed] stripes stripe_size]] le_number | lv_size] mirror_copies] mir- ror_write_cache] lv_name] permission] relocate] 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. DESCRIPTION
The command creates a new logical volume within the volume group specified by vg_name. The total number of logical volumes that can be created depends on the version of the volume group. Use the command to find the maximum number of logical volumes for each volume group version. See lvm(7) for more information. If you specify the option, a new logical volume is created with that name. Otherwise, a system-generated name of the form is created. For a logical volume created within a volume group version 1.0, N is the decimal equivalent of the two least significant bytes of the minor number of the new logical volume and the range for N is 1 to 255. For a logical volume created within a volume group version 2.0, N is the decimal equivalent of the least significant 12 bits of the logical volumes minor number, and the range for N is 1 to 511. For a logical volume created within a volume group version 2.1, N is the decimal equivalent of the least significant 12 bits of the logical volumes minor number, and the range for N is 1 to 2047 (see lvm(7)). Two device files are created in vg_name: a block device file named lv_name or and a character (raw) device file named or If you omit the and 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 command (see lvextend(1M)). If you specify or 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 and commands (see lvchange(1M), lvex- tend(1M), and lvreduce(1M)). Options and Arguments The and options are only meaningful if the optional HP MirrorDisk/UX software has been installed on the system. recognizes the following options and arguments: vg_name The path name of a volume group. Set automatic backup for this invocation of this command. autobackup can have one of the following values: Automatically back up configuration changes made to the logical volume. This is the default. After this command executes, the command (see vgcfgbackup(1M)) is executed for the volume group to which the logical volume belongs. Do not back up configuration changes this time. Set mirror consistency recovery. This option is effective only when is specified. It is ignored for mirror_consistency can have one of the following values: 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. 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 section for more details. Set the contiguous allocation policy. A contiguous logical volume has three characteristics: o Physical extents are allocated in ascending order, o No gap is allowed between physical extents within a mirror copy, o Physical extents of any mirror copy all reside on a single physical volume. Use the strict and contiguous options together to form various combined allocation policies on a logical volume. For exam- ple, 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: Set a contiguous allocation policy. Do not set a contiguous allocation policy. This is the default. The enforcement of a contiguous allocation policy via the option is not supported on a striped logical volume. 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: Establish a parallel scheduling policy. This is the default. Establish a sequential scheduling policy. Use this value with care, because it leads to performance loss in most cases. Set the distributed allocation policy. distributed can have one of the following values: Turn on distributed allocation. 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 vol- ume. 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 to ensure that mirrors of distributed extents do not overlap (for maximum availability). lvcreate(1M) will obtain the list of available physical volumes from See vgextend(1M) for more information on physical volume groups and When a logical volume with distributed extents is mirrored, the resulting layout is commonly referred to as EXTENT-BASED MIR- RORED 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 and the contiguous allocation policy 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 Set the number of disks to stripe across. stripes must be at least 2 and no greater than a volume group version-dependent maximum; use the command to determine the maximum supported stripes for the volume group version. If is provided and is not, the stripe size is set to 8 kilobytes. Set the size in kilobytes of the stripe. stripe_size should be a power of 2. stripe_size must be at least 4 and no greater than a volume group version-dependent max- imum; use the command to determine the maximum supported stripe_size for the volume group version. If is provided and 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 option. Allocate space to the logical volume, specified in logical extents. le_number must be at least 1 and no greater than a volume group version-dependent maximum; use the command to determine the maximum number of logical extents for the volume group version. The default is described above. Either or can be specified, but not both. Allocate space to the logical volume, specified in megabytes. lv_size must be at least 1 and no greater than a volume group version-dependent maximum; use the command to determine the maximum size for the volume group version. 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 command (see vgcreate(1M)). The default is described above. Either the or the option can be specified, but not both. Set the number of mirror copies allocated for each logical extent. A mirror copy contains the same data as the original. mirror_copies must be at least 1 and no greater than a volume group version-dependent maximum; use the command to determine the maximum number of mirror copies for the volume group version. The default value is 0 (no mirror copies). Set the Mirror Write Cache flag. mirror_write_cache can have one of the following values: 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. Set Mirror Write Cache to off. Mirror write does not incur an additional write to the Mirror Consistency Record. 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. Set the access permission. permission can have one of the following values: Set the access permission to read-write. This is the default. Set the access permission to read-only. This parameter is valid for creating a logical volume within volume groups version 1.0 only. For volume groups versions 2.0 or higher, it is ignored and relocation is not supported. 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: 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. is the default value of this flag. 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: Set a strict allocation policy. Mirrors of a logical extent cannot share the same physical volume. This is the default. 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. 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 stripes. mirror_copies is the number of mirror copies allocated for each logical extent. It is set with the 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. Shared Volume Group Considerations For volume group version 1.0 and 2.0, cannot be used if the volume group is activated in shared mode. For volume groups version 2.1 (or higher), can be performed when activated in either shared, exclusive, or standalone mode. Note that the daemon must be running on all the nodes sharing a volume group activated in shared mode. See lvmpud(1M). When is issued, it creates the logical volume device special files on all the nodes sharing the volume group. The device special files are created with the same name on the nodes sharing the volume group. When a node wants to share the volume group, the user must first execute a if logical volumes were created at the time the volume group was not activated on that node. The logical volumes device special files should have the same name on all the nodes sharing the volume group. If PVG-strict allocation policy is set, the file used is the one on the system where the command is issued. LVM shared mode is currently only available in Serviceguard cluster. EXTERNAL INFLUENCES
Environment Variables determines the language in which messages are displayed. If 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 Create a logical volume in volume group with non-strict allocation policy: Create a logical volume of size 100 MB in volume group Create a logical volume of size 90 MB striped across 3 disks with a stripe size of 64 KB: Create a logical volume of size 90 MB striped across 3 disks with one mirror copy and a stripe size of 64 KB: Distributed Allocation Policy This example shows how the option can be used to create EXTENT-BASED MIRRORED STRIPES. Assume that volume group has two physical volume groups: and 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: The distributed allocation proceeds as follows: o A free extent is allocated from the 1st pvol in pvg1. o A free extent is allocated from the 2nd pvol in pvg1. o A free extent is allocated from the 1st pvol in pvg1. o A free extent is allocated from the 2nd pvol in pvg1. o A free extent is allocated from the 1st pvol in pvg1. o 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 logi- cal volume with mirror consistency recovery turned off are: o data not needed after a crash, such as swap or other raw scratch data, or o data that an application itself will automatically reconstruct; for example, a raw logical volume for which a database keeps a log of incomplete transactions. SEE ALSO
lvchange(1M), lvdisplay(1M), lvextend(1M), lvmadm(1M), lvmpud(1M), lvreduce(1M), pvchange(1M), intro(7), lvm(7). lvcreate(1M)