Creates a logical volume.
mklv [ -a position ] [ -b badblocks ] [ -c copies ] [ -C stripewidth ] [ -d schedule ] [ -R PreferredRead ] [ -e range ] [ -i ] [ -L label ] [ -m mapfile ] [ -o y / n ] [ -r relocate ] [ -s strict ] [ -t type ] [ -T O ] [ -u upperbound ] [ -v verify ] [ -w mirrorwriteconsistency ] [ -x maximum ] [ -y newlogicalvolume | -Y prefix ] [ -S stripsize ] [ -U userid ] [ -G groupid ] [ -P modes ] [ -p copyn=mirrorpool ] [ -O y | n ] [ -k y | n ] volumegroup number [ physicalvolume ... ]
The mklv command creates a new logical volume within the volumegroup. For example, all file systems must be on separate logical volumes. The mklv command allocates the number of logical partitions to the new logical volume. If you specify one or more physical volumes with the physicalvolume parameter, only those physical volumes are available for allocating physical partitions; otherwise, all the physical volumes within the volume group are available.
The default settings provide the most commonly used characteristics, but use flags to tailor the logical volume to the requirements of your system. After a logical volume is created, its characteristics can be changed with the chlv command.
The default allocation policy is to use a minimum number of physical volumes per logical volume copy, to place the physical partitions belonging to a copy as contiguously as possible, and then to place the physical partitions in the desired region specified by the -a flag. Also, by default, each copy of a logical partition is placed on a separate physical volume.
The -m flag specifies exact physical partitions to be used when creating the logical volume.
The -U, -G, and -P flags can be used to set the ownership, group, and permissions, respectively, of the logical volume device special files. Only root users can set these values. For scalable and big vg format volume groups that are exported, specify the -R flag with the importvg command to restore these values upon import.
You can specify logical volumes sizes in 512 Blocks/KB/MB/GB when using the mklv command. The logical volumes sizes must be integer values.
Physical partitions are numbered starting at the outermost edge with number one.
- Changes made to the logical volume are not reflected in the file systems. To change file system characteristics use the chfs command.
- Each logical volume has a control block. This logical volume control block is the first few hundred bytes within the logical volume. Care has to be taken when reading and writing directly to the logical volume to allow for the control block. Logical volume data begins on the second 512-byte block.
- To use this command, you must either have root user authority or be a member of the system group.
- When creating a striped logical volume using the -S flag, you must specify two or more physical volumes or use the -C or -u flag.
- When creating a striped logical volume, the number of partitions must be an even multiple of the striping width. If not, the number of partitions will be rounded up to the next valid value.
- The mklv command is not allowed on a snapshot volume group.
- Mirror Write Consistency (MWC) and Bad Block Relocation (BBR) are not supported in a concurrent setup with multiple active nodes accessing a disk at the same time. These two options must be disabled in this type of concurrent setup.
- Bad block relocation policy of a logical volume is not supported on a volume group that is created with 4 KB block physical volumes.
You can use the System Management Interface Tool (SMIT) smit mklv fast path to run this command.
File Systems on Striped Logical Volumes
If you want to create a file system on a striped logical volume, you should create the striped logical volume before you run the crfs command or mkfs command to create the file system. In order to maximize the use of disk space within the striping width, you should choose hard disks of the same size when creating the striped logical volume. The striping width is the number of hard disks that form the striped logical volume.
|-a position||Sets the intra-physical volume allocation policy (the position
of the logical partitions on the physical volume). The position variable
can be one of the following:
|-b badblocks||Sets the bad-block relocation policy. The Relocation variable
can be one of the following:
|-c copies||Sets the number of physical partitions allocated for each logical partition. The copies variable can be set to a value from 1 to 3; the default is 1.|
|-C stripewidth||Sets the Stripe width of the logical volume. If the Stripewidth is not entered it is assumed to be the upperbound or the total number of disks specified on the command line.|
|-d schedule||Sets the scheduling policy when more than one logical partition
is written. The schedule variable can be one of the following:
Note: The -R flag overwrites the read policy specified by the -d flag. If the preferred copy is not available, the read operations follow the scheduling policy.
|-R PreferredRead||Sets read preference to the copy of the logical volume. If the -R flag is specified and if the preferred copy is available, the read operation occurs from the preferred copy. If the preferred copy is not available, the read operations follow the scheduling policy of the logical volume. The PreferredRead variable can be set to a value in the range 0 -3. The default value is 0.|
|-e range||Sets the inter-physical volume allocation policy (the number
of physical volumes to extend across, using the volumes that provide
the best allocation). The Range value is limited by the upperbound variable,
(set with the -u flag)
and can be one of the following:
|-G groupid||Specifies group ID for the logical volume special file.|
|-i||Reads the physicalvolume parameter from standard input. Use the -i flag only when physicalvolume is entered through standard input.|
|-k y | n||Enables the data encryption option in the logical volume. The -k flag is
available in IBM® AIX® 7.2 with Technology Level 5, or later. You can
specify the following values for this flag:
|-L||Sets the logical volume label. The default label is None.
The maximum size of the label file is 127 characters.
Note: If the logical volume is going to be used as a journaled file system (JFS), then the JFS will use this field to store the mount point of the file system on that logical volume for future reference.
|-m mapfile||Specifies the exact physical partitions to allocate. Partitions
are used in the order given by the file designated by the mapfile parameter.
All physical partitions belonging to a copy are allocated before allocating
for the next copy. The mapfile format is:
Important: When you use map files, you must understand and adhere to all LV-allocation parameters such as strictness, upperbound, and stripe width. Using map files bypasses the checks done in the LVM-allocation routines. This is important for striped LVs, which are assumed to have a typical striped allocation pattern conforming to the stripe width.
|-o y / n||Turns on/off serialization of overlapping I/Os. If serialization is turned on then overlapping I/Os are not allowed on a block range and only a single I/O in a block range is processed at any one time. Most applications like file systems and databases do serialization so serialization should be turned off. The default for new logical volumes is off.|
|-O y / n||Enables the infinite retry option of the logical
Note: The infinite retry option is ignored for a logical volume (LV) when active mirror write consistency is set. The infinite retry option must be enabled at the volume group level to work for a logical volume when active mirror write consistency is set.
Note: The infinite retry option is not supported in the Geographic Logical Volume Manager (GLVM) environment.
|-p copyn=mirrorpool||Enables mirror pools for the logical volume. A mirror pool is assigned to a copy using the copyn=mirrorpool parameter. Specify a mirror pool for each copy. To specify more than one copyn=mirrorpool pair, provide multiple -p copyn=mirrorpool flags. Mirror pool names can be up to 15 characters and follow the same rules that apply to volume group names and logical volume names.|
|-P modes||Specifies permissions (file modes) for the logical volume special file.|
|-r relocate||Sets the reorganization relocation flag. For striped logical
volumes, the relocate parameter must be set to n (the
default for striped logical volumes). The relocate parameter
can be one of the following:
|-s strict||Determines the strict allocation policy. Copies of a logical
partition can be allocated to share or not to share the same physical
volume. The strict parameter is represented by one of the following:
|-S stripSize||Specifies the number of bytes per strip (the strip size multiplied
by the number of disks in an array equals the stripe size). Valid
values include 4K, 8K, 16K, 32K, 64K, 128K, 256K, 512K, 1M, 2M, 4M,
8M, 16M, 32M, 64M, and 128M.
Note: The -d, -e, and -s flags are not valid when creating a striped logical volume using the -S flag.
|-t type||Sets the logical volume type. The standard types are jfs (journaled file systems),
jfslog (journaled file system logs), jfs2 (enhanced journaled file system),
jfs2log (enhanced journaled file system logs), and paging (paging spaces), but a user
can define other logical volume types with this flag. You cannot create a striped logical volume of
type boot. The default is jfs. If a log is manually created for a file system, the
user must run the logform command to clean out the new jfslog before the log can be used. For
example, to format the logical volume logdev, type:
where /dev/logdev is the absolute path to the logical volume.
|-T O||The -T O option indicates that the logical
volume control block does not occupy the first block of the logical volume. Therefore, the space is
available for application data. Applications can identify this type of logical volume with the
A logical volume created without this option has a device subtype of
|-U userid||Specifies user ID for logical volume special file.|
|-u upperbound||Sets the maximum number of physical volumes for new allocation. The value of the upperbound variable should be between one and the total number of physical volumes. When using super strictness, the upper bound indicates the maximum number of physical volumes allowed for each mirror copy. When using striped logical volumes, the upper bound must be multiple of stripewidth. If upperbound is not specified it is assumed to be stripewidth for striped logical volumes.|
|-v verify||Sets the write-verify state for the logical volume. Causes
(y) all writes to the logical volume to either be verified
with a follow-up read, or prevents (n) the verification of
all writes to the logical volume. The verify parameter is represented
by one of the following:
|-x maximum||Sets the maximum number of logical partitions that can be allocated to the logical volume. The default value is 512. The number represented by the number parameter must be equal to or less than the number represented by the maximum variable.|
Specifies the logical volume name rather than having the name generated automatically. Logical volume names must be unique system wide and can range from 1 to 15 characters. If the volumegroup is varied on in concurrent mode, the new logical volume name should be unique across all the concurrent nodes where the volumegroup is varied on. The name cannot begin with a prefix already defined in the PdDv class in the Device Configuration Database for other devices.
The logical volume name created is sent to standard output. The logical volume name can only contain the following characters:
|-Y prefix||Specifies the prefix to use instead of the prefix in a system-generated name for the new logical volume. The prefix must be less than or equal to 13 characters. The name cannot begin with a prefix already defined in the PdDv class in the Device Configuration Database for other devices, nor be a name already used by another device.|
- To make a logical volume in volume group vg02 with one
logical partition and a total of two copies of the data, type:
mklv -c 2 vg02 1
- To make a logical volume in volume group vg03 with nine logical partitions and a total of three copies spread across a maximum of two physical volumes, and whose allocation policy is not strict, type:
- To make a logical volume in vg04 with five logical partitions allocated across the center sections of the physical volumes when possible, with no bad-block relocation, and whose type is paging, type:
- To make a logical volume in vg03 with 15 logical partitions
chosen from physical volumes hdisk5, hdisk6, and hdisk9,
mklv vg03 15 hdisk5 hdisk6 hdisk9
- To make a striped logical volume in vg05 with a strip
size of 64K across 3 physical volumes and 12 logical partitions, type:
mklv -u 3 -S 64K vg05 12
- To make a striped logical volume in vg05 with a strip
size of 8K across hdisk1, hdisk2, and hdisk3 and 12 logical partitions,
mklv -S 8K vg05 12 hdisk1 hdisk2 hdisk3
- To request a logical volume with a minimum size of 10MB, type:
mklv VGNAME 10M #
The mklv command will determine the number of partitions needed to create a logical volume of at least that size.You can use uppercase and lowercase letters as follows:
B/b 512 byte blocks K/k KB M/m MB G/g GB
- To create three copies of logical volume in volume
testvgand to set the read preference to the second logical volume copy, enter the following command:
mklv -c 3 -R 2 -y testlv testvg 10
|/usr/sbin||Directory where the mklv command resides.|
|/tmp||Directory where the temporary files are stored while the command is running.|
|/dev||Directory where the character and block device entries for the logical volume are created.|