[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 3

mklv Command

Purpose

Creates a logical volume.

Syntax

mklv [ -a Position ] [ -b BadBlocks ] [ -c Copies ] [ -d Schedule ] [ -e Range ] [ -i ] [ -L Label ] [ -m MapFile ] [ -o Y / N ] [ -r Relocate ] [ -s Strict ] [ -t Type ] [ -u UpperBound ] [ -v Verify ] [ -w MirrorWriteConsistency ] [ -x Maximum ] [ -y NewLogicalVolume | -Y Prefix ] [ -S StripeSize ] [ -U Userid ] [ -G Groupid ] [ -P Modes ] VolumeGroup Number [ PhysicalVolume ... ]

Description

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.

If the volume group in which the logical volume is being created is in big vg format, U, G, and P flags can be used to set the ownership, group, and permissions respectively, of the special device files. Only root user will be able to set these values. If the volume group is exported, these values can be restored upon import if R flag is specified with importvg command.

You can specify logical volumes sizes in 512 Blocks/KB/MB/GB when using the mklv command. (See Examples.)

Physical partitions are numbered starting at the outermost edge with number one.

Notes:
  1. Changes made to the logical volume are not reflected in the file systems. To change file system characteristics use the chfs command.
  2. 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.
  3. To use this command, you must either have root user authority or be a member of the system group.
  4. When creating a striped logical volume using the -S flag, you must specify two or more physical volumes or use the -u flag.
  5. When creating a striped logical volume, the number of partitions must be an even multiple of the striping width.
  6. To create a striped logical volume with more than one copy, all active nodes should be at least AIX 4.3.3 or later when the volume group is in the concurrent mode.
  7. The mklv command is not allowed on a snapshot volume group.

You can use the Volumes application in Web-based System Manager to change volume characteristics. You could also use the System Management Interface Tool (SMIT) smit mklv fast path to run this command.

Flags

-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:
m
Allocates logical partitions in the outer middle section of each physical volume. This is the default position.
c
Allocates logical partitions in the center section of each physical volume.
e
Allocates logical partitions in the outer edge section of each physical volume.
ie
Allocates logical partitions in the inner edge section of each physical volume.
im
Allocates logical partitions in the inner middle section of each physical volume.
-b BadBlocks Sets the bad-block relocation policy. The Relocation variable can be one of the following:
y
Causes bad-block relocation to occur. This is the default.
n
Prevents bad-block relocation from occurring.
-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.
-d Schedule Sets the scheduling policy when more than one logical partition is written. The Schedule variable can be one of the following:
p
Establishes a parallel scheduling policy. This is the default for scheduling policy.
ps
Parallel write with sequential read policy. All mirrors are written in parallel but always read from the first mirror if the first mirror is available.
pr
Parallel write round robbin read. This policy is similar to the parallel policy except an attempt is made to spread the reads to the logical volume more evenly across all mirrors.
s
Establishes a sequential scheduling policy.
-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:
x
Allocates across the maximum number of physical volumes.
m
Allocates logical partitions across the minimum number of physical volumes. This is the default range.
-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.
-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 in the MapFile parameter. Used partitions in the MapFile parameter are not legal, because the new logical volume cannot occupy the same physical space as a previously allocated logical volume. All physical partitions belonging to a copy are allocated before allocating for the next copy of the logical volume. The MapFile parameter format is: PVname:PPnum1[-PPnum2]. In this example, PVname is a physical volume name (for example, hdisk0) as specified by the system. It is one record per physical partition or a range of consecutive physical partitions. PPnum is the physical partition number.
PVname
Name of the physical volume as specified by the system.
PPnum
Physical partition number.
-oY / N Turns on/off serialization of overlapping IOs. If serialization is turned on then overlapping IOs are not allowed on a block range and only a single IO in a block range is proccessed 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.
-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:
y
Allows the logical volume to be relocated during reorganization. This is the default for relocation.
n
Prevents the logical volume from being relocated during reorganization.
-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:
y
Sets a strict allocation policy, so copies for a logical partition cannot share the same physical volume. This is the default for allocation policy.
n
Does not set a strict allocation policy, so copies for a logical partition can share the same physical volume.
s
Sets a super strict allocation policy, so that the partitions allocated for one mirror cannot share a physical volume with the partitions from another mirror.
-S StripeSize Specifies the number of bytes per striped. Must be a power of two, between 4K and 128K , for example 4K, 8K, 16K, 32K, 64K, or 128K.
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 filesystem, 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:

logform /dev/logdev

where /dev/logdev is the absolute path to the logical volume.

-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 striped logical volumes or super strictness the upper bound indicates the maximum number of physical volumes allowed for each mirror copy.
Note
When creating a super strict logical volume you must specify physical volumes or use the -u flag.
-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:
n
Prevents the verification of all write operations to the logical volume. This is the default for the -v flag.
y
Causes the verification of all write operations to the logical volume.
-w MirrorWriteConsistency
y or a
Turns on active mirror write consistency that ensures data consistency among mirrored copies of a logical volume during typical I/O processing.
p
Turns on passive mirror write consistency that ensures data consistency among mirrored copies during volume group synchronization after a system interruption.
Note
This functionality is only available on Big Volume Groups.
n
No mirror write consistency. See the -f flag of the syncvg command.
-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. The maximum number of logical partitions per logical volume is 32,512.
-y NewLogicalVolume Specifies the logical volume name to use instead of using a system-generated name. Logical volume names must be unique system wide name, and can range from 1 to 15 characters. If the volume group is varied on in concurrent mode, the new name should be unique across all the concurrent nodes the volume group is varied on. The name cannot begin with a prefix already defined in the PdDv class in the Device Configuration Database for other devices.
-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.

Examples

  1. 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
  2. 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:
    mklv  -c 3   -u 2   -s n vg03 9
  3. 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:
    mklv  -a c  -t paging  -b n vg04 5
  4. To make a logical volume in vg03 with 15 logical partitions chosen from physical volumes hdisk5, hdisk6, and hdisk9, type:

    mklv vg03 15 hdisk5 hdisk6 hdisk9
  5. To make a striped logical volume in vg05 with a stripe size of 64K across 3 physical volumes and 12 logical partitions, type:

    mklv -u 3 -S 64K vg05 12
  6. To make a striped logical volume in vg05 with a stripe size of 8K across hdisk1, hdisk2, and hdisk3 and 12 logical partitions, type:

    mklv -S 8K vg05 12 hdisk1 hdisk2 hdisk3
  7. 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

Files

/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.

Related Information

The chfs command, chlv command, chpv command, extendlv command, mklvcopy command, rmlvcopy command, syncvg command.

The Logical Volume Storage Overview in AIX 5L Version 5.2 System Management Concepts: Operating System and Devices.

For information on installing the Web-based System Manager, see Chapter 2: Installation and System Requirements in AIX 5L Version 5.2 Web-based System Manager Administration Guide.

The System Management Interface Tool (SMIT) Overview in AIX 5L Version 5.2 System Management Concepts: Operating System and Devices.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]