5.1.1 Limitations of Logical Volume Storage

5.2 Managing Physical Volumes

The following sections discuss adding a new disk drive, changing physical volume characteristics, and monitoring the physical volumes.

5.2.1 Configuration of Physical Volume

The following three methods can be used to configure a new disk drive. If the LVM will use this disk, it must also be made of a physical volume.

5.2.1.1 Method 1

This method is used when it is possible to shut down and power off the system prior to attaching the disk.

When the system is booted after adding a disk drive, the cfgmgr command is run by the system during booting, which will automatically configure the disk. After boot-up is complete, log in as root and run lspv, and look for a new disk entry in the output as shown in the following example.

hdisk1  none                     none
  • or
  • hdisk1  00005264d21adb2e         none
    

    The 16-digit number in the second column of the preceding example is the physical volume identifier (PVID).

    If the output shows the new disk with a PVID, it can be used by LVM for configuration. If the new disk does not have a PVID, then use the procedure 5.2.2 Making an Available Disk a Physical Volume to allow the disk to be used by the LVM.

    5.2.1.2 Method 2

    This method may be used when it is not possible to shut down or power off the system prior to attaching the disk. Perform the following tasks.

    1. Run lspv to list the physical disks already configured on the system as shown in the following example.
      # lspv
      hdisk0       000005265ac63976    rootvg
      

    2. To configure all newly detected devices on the system (including the new disk) use the following command.
      cfgmgr
      

    3. Run lspv again, and look for a new disk entry in the output as shown in the following example.
      hdisk1    none                none
      

      or

      hdisk1   00005264d21adb2e     none
      

    Once you have determined the name of the newly configured disk, use the procedure described in 5.2.2 Making an Available Disk a Physical Volume to allow the disk to be utilized by the Logical Volume Manager.

    5.2.1.3 Method 3

    This method may be used when it is not possible to shut down or power off the system prior to attaching the disk. This method requires the following information about the new disk.

    Use the following command to configure the disk and ensure that it is available as a physical volume by using the pv=yes attribute.

    mkdev -c disk -s subclass -t type -p parentname \ -w whereconnected -a pv=yes

    The pv=yes attribute makes the disk a physical volume and writes a boot record with a unique physical volume identifier onto the disk (if it does not already have one).

    5.2.2 Making an Available Disk a Physical Volume

    A new disk drive can only be assigned to volume groups. To be used by the LVM, a disk must be configured as a physical volume. The following command will change an available disk (hdisk1) to a physical volume by assigning a physical volume identifier (PVID) if it does not already have one.

    chdev -l hdisk1 -a pv=yes

    This command has no effect if the disk is already a physical volume.

    5.2.3 Modifying Physical Volume Characteristics

    This section discusses the two characteristics which can be changed for a physical volume to control the use of physical volumes using the chpv command.

    5.2.3.1 Setting Allocation Permission for a Physical Volume

    The allocation permission for a physical volume determines if physical partitions contained on this disk, which are not allocated to a logical volume yet, can be allocated for use by logical volumes. Setting the allocation permission defines whether or not the allocation of new physical partitions is permitted for the specified physical volume.

    The following command is used to turn off the allocation permission for physical volume hdisk1.

    chpv -a n hdisk1

    To turn the allocation permission back on, use the following command.

    chpv -a y hdisk1
    

    5.2.3.2 Setting the Availability of a Physical Volume

    The availability of a physical volume defines whether any logical input/output operations can be performed to the specified physical volume. Physical volumes should be made unavailable when they are to be removed from the system or are lost due to failure.

    The following command is used to set the state of a physical volume to unavailable.

    chpv -v r pvname

    This will quiesce all VGDA and VGSA copies on the physical volume, and the physical volume will not take part in future vary on quorum checking. Also, information about the specified volume will be removed from the VGDAs of the other physical volumes in that volume group.

    The following command will make a physical volume available to the system. chpv -v a pvname

    Note

    The chpv command uses space in the /tmp directory to store information while it is executing. If it fails, it could be due to lack of space in the /tmp directory. Create more space in that directory and try again.

    5.2.4 Removing Physical Volumes

    The physical volume must be unconfigured before it can be removed from the system. The following example shows how to unconfigure a physical volume (hdisk1) and change its state from available to defined using the rmdev command.

    rmdev -l hdisk1

    The definition of this physical volume will remain in the ODM.

    5.2.5 Listing Information about Physical Volumes

    A physical volume correctly installed on the system can be assigned to a volume group and can subsequently be used to hold file systems and logical volumes.

    The information about free physical partitions and their availability within different sectors on the disk can be very useful. The following section will discuss using the lspv command to obtain such information pertinent to physical volumes.

    5.2.5.1 Listing Physical Volumes on the System

    The lspv command executed without any flag will produce output that will identify the physical volumes by name that are known to the system as shown in the following example.

    # lspv
    hdisk0         00615147ce54a7ee    rootvg
    hdisk1         00615147a877976a    rootvg
    #
    

    The lsdev command with option with the -C option and -c class will also list the physical volumes on the system along with the status of each physical volume as shown in the following example.

    # lsdev -C -c disk
    hdisk0 Available 40-58-00-0,0 16 Bit SCSI Disk Drive
    hdisk1 Available 40-58-00-1,0 16 Bit SCSI Disk Drive
    hdisk2 Available 20-68-L      SSA Logical Disk Drive
    hdisk3 Available 20-68-L      SSA Logical Disk Drive
    hdisk4 Available 20-68-L      SSA Logical Disk Drive
    hdisk5 Available 20-68-L      SSA Logical Disk Drive
    hdisk6 Available 20-68-L      SSA Logical Disk Drive
    #
    

    5.2.5.2 Listing Physical Volume Characteristics

    The following example shows the use of the lspv command to retrieve more detailed information about a physical volume.

    
    # lspv hdisk1
    PHYSICAL VOLUME:    hdisk1                   VOLUME GROUP:     rootvg
    PV IDENTIFIER:      00615147a877976a         VG IDENTIFIER     00615147b27f2b40
    PV STATE:           active
    STALE PARTITIONS:   0                        ALLOCATABLE:      yes
    PP SIZE:            4 megabyte(s)            LOGICAL VOLUMES:  13
    TOTAL PPs:          238 (952 megabytes)      VG DESCRIPTORS:   1
    FREE PPs:           71 (284 megabytes)
    USED PPs:           167 (668 megabytes)
    FREE DISTRIBUTION:  48..02..00..00..21
    USED DISTRIBUTION:  00..46..47..47..27
    #
    
    

    The left hand pair of columns holds information about the physical volume itself. The right hand pair displays information concerning the volume group of which the physical volume is a member.

    Following are the meanings of various fields in the preceding example.

    PHYSICAL VOLUME
    The name of the specified physical volume.
    PV IDENTIFIER
    The physical volume identifier (unique to the system).
    PV STATE
    The state of the physical volume. This defines whether or not the physical volume is available for logical input/output operations. It can be changed using the chpv command.
    STALE PARTITIONS
    The number of stale partitions.
    PP SIZE
    The size of a physical partition. This is a characteristic of the volume group and is set only at the creation of the volume group as an argument to the mkvg command. The default size is 4 MB.
    TOTAL PPs
    The total number of physical partitions, including both free and used partitions available on the physical volume.
    FREE PPs
    The number of free partitions available on the physical volume.
    USED PPs
    The number of used partitions on the physical volume.
    FREE DISTRIBUTION
    This field summarizes the distribution of free physical partitions across the physical volume, according to the sections of the physical volume on which they reside.
    USED DISTRIBUTION
    Same as free distribution, except that it displays the allocation of used physical partitions.
    VOLUME GROUP
    The name of the volume group to which the physical volume is allocated.
    VG IDENTIFIER
    The numerical identifier of the volume group to which the physical volume is allocated.
    VG STATE
    State of the volume group. If the volume group is activated with the varyonvg command, the state is either active/complete (indicating all physical volumes are active) or active/partial (indicating some physical volumes are not active). If the volume group is not activated with the varyonvg command, the state is inactive.
    ALLOCATABLE
    Whether the system is permitted to allocate new physical partitions on this physical volume.
    LOGICAL VOLUMES
    The number of the logical volumes in the volume group.
    VG DESCRIPTORS
    The number of VGDAs for this volume group which reside on this particular physical volume.

    5.2.5.3 Listing Logical Volume Allocation within a PV

    The following example shows the lspv command with the -l option to list the physical volume hdisk1. The output shows the name of all the logical volumes on the physical volume, the number of physical and logical partitions allocated, the distribution across the physical volume, and the mount point, if it exists.

    # lspv -l hdisk1
    hdisk1:
    LV NAME               LPs   PPs   DISTRIBUTION          MOUNT POINT
    rawlv                 1     1     01..00..00..00..00    N/A
    hd4                   2     2     02..00..00..00..00    /
    hd9var                1     1     01..00..00..00..00    /var
    hd3                   8     8     01..00..07..00..00    /tmp
    lv06                  5     5     00..05..00..00..00    /home2
    lv07                  13    13    00..13..00..00..00    /backfs
    rawlv1                2     2     00..02..00..00..00    N/A
    copied                2     2     00..02..00..00..00    N/A
    newlv                 1     1     00..01..00..00..00    N/A
    fslv00                1     1     00..01..00..00..00    N/A
    hd6                   1     1     00..01..00..00..00    N/A
    mytest                1     1     00..01..00..00..00    N/A
    #
    

    5.2.5.4 Listing Physical Partition Allocation by PV Region

    The example provided in Figure 32 shows how to retrieve more detailed information about the range of physical partitions allocated to a logical volume and the region of disk used for those partitions.



    Figure 32: Status and Characteristics of hdisk1 by Physical Partitions

    The following is the description of the fields shown in the preceding example.

    PP RANGE
    The range of physical partitions for which the current row of data applies.
    STATE
    Whether or not the partitions have been allocated. Value can be either used or free.
    REGION
    Notional region of the disk within which the partitions are located.
    LV NAME
    Name of the logical volume to which the partitions in question have been allocated.
    TYPE
    Type of file system residing on the logical volume.
    MOUNT POINT
    Mount point of the file system, if applicable.

    5.2.5.5 Listing Physical Partition Allocation Table

    To determine the degree of contiguity of data on the system in order to improve the I/O performance of a logical volume you can use the lspv command with the -M option as shown in Figure 33. You may decide to reorganize the system after analyzing the output.



    Figure 33: Physical Partition Allocation by Disk Region

    The first column indicates the physical partition (if a group of contiguous partitions are free, it will indicate a range of partitions) for a particular hard disk. The second column indicates which logical partition of which logical volume is associated with that physical partition.

    5.2.6 Migrating the Contents of Physical Volume

    The physical partitions belonging to one or more specified logical volumes can be moved from one physical volume to one or more other physical volumes within a volume group using the migratepv command.

    Note

    The migratepv command cannot move data between different volume groups, as shown in Figure 34.





    Figure 34: migratepv Does Not Work across Volume Groups

    The following procedure describes how to move the data from a failing disk before it is removed for repair or replacement.

    1. Determine which disks are in the volume group. Make sure that the source and destination physical volumes are in the same volume group. If the source and destination physical volumes are in the same volume group, proceed to step 3.
    # lsvg -p hdisk0
    rootvg:
         PV_NAME    PV STATE   TOTAL PPs   FREE PPs   FREE DISTRIBUTION
         hdisk0     active     159         0          00..00..00..00..00
    
    1. If you are planning to migrate to a new disk, such as when you have a failing disk, perform the following steps:
      1. Make sure the disk is available by entering the following.
        # lsdev -Cc disk
        hdisk0  Available  00-08-00-30  670 MB  SCSI  Disk Drive
        hdisk1  Available  00-08-00-20  857 MB  SCSI  Disk Drive
        

      2. If the disk is listed and in the available state, make sure it does not belong to another volume group using the following command. (In the following example, hdisk1 can be used as a destination disk.)
        # lspv
        hdisk0     0000078752249812   rootvg
        hdisk1     000000234ac56e9e   none
        

      3. If the disk is not listed or is not available, you need to check or install the disk.

      4. Add the new disk to the volume group using the command:

        extendvg VGName hdiskNumber

    2. Make sure that you have enough room on the target disk for the source that you want to move.
      1. Determine the number of physical partitions on the source disk by using the following command. (SourceDiskNumber will be of the form hdiskNumber.)
        lspv SourceDiskNumber | grep "USED PPs"
        

        The output will look similar to the following:

        USED PPs: 159 (636 megabytes)

        In this example, you would need 159 free PPs on the destination disk to successfully complete the migration.

      2. Determine the number of free physical partitions on the destination disk or disks using the following command for each destination disk (DestinationDiskNumber will be of the form hdiskNumber.)
        lspv DestinationDiskNumber | grep "FREE PPs"
        

        Add the free PPs from all of the destination disks. If the sum is larger than the number of USED PPs from step 3, you will have enough space for the migration.

    3. Follow this step only if you are migrating data from a disk in the rootvg volume group. If you are migrating data from a disk in a user-defined volume group, proceed to step 5.

      Check to see if the boot logical volume (hd5) is on the source disk:

      lspv -l SourceDiskNumber | grep hd5
      

      If you get no output, the boot logical volume is not located on the source disk. Continue to step 5.

      If you get output similar to the following:

      hd5            2   2   02..00..00..00..00   /blv
      

      then run the following command:

      migratepv -l hd5 SourceDiskNumber DestinationDiskNumber
      


      Note
      • This migratepv command is not allowed if the volume group is varied on in concurrent mode.

      • The migratepv command cannot migrate striped logical volumes. To move data from one physical volume to another, use the cplv command to copy the data and then use the rmlv command to remove the old copy.

      • You must either have root user authority or be a member of the system group to execute the migratepv command.


      Next, you will get a message warning you to perform the bosboot command on the destination disk.

      Note

      When the boot logical volume is migrated from a physical volume, the boot record on the source should be cleared. Failure to clear this record may result in a system hang. When you execute the bosboot command, you must also execute mkboot -c.



      Execute the mkboot -c command to clear the boot record on the source. Do the following:

      bosboot -a -d /dev/DestinationDiskNumber
      

      then:

      bootlist -m normal DestinationDiskNumber
      

      then:

      mkboot -c -d /dev/SourceDiskNumber
      

    4. Executing the SMIT fast path command smitty migratepv to migrate the data will show a screen similar to Figure 35.



      Figure 35: smitty migratepv Command

    5. List the physical volumes (PF4), and select the source physical volume you examined previously.

    6. Go to the DESTINATION physical volume field. If you accept the default, all the physical volumes in the volume group are available for the transfer. Otherwise, select one or more disks with adequate space for the partitions you will be moving (from step 4).

    7. If you wish, go to the Move only data belonging to this LOGICAL VOLUME field, and list and select a logical volume. You will move only the physical partitions allocated to the logical volume specified that are located on the physical volume selected as the source physical volume.

    8. Press Enter to move the physical partitions.

    9. To remove the source disk from the volume group, such as when it is failing, enter the following command:
      reducevg VGNname SourceDiskNumber
      

    10. To physically remove the source disk from the system, such as when it is failing, enter the following command:
      rmdev -l SourceDiskNumber -d
      

    Following are a few more examples of using the migratepv command.

    5.3 Managing Volume Groups