본문 바로가기

IBM/AIX

Copying a complete logical volume

Copying a complete logical volume(cplv, copy from source LV to destination LV that is lager than it, soruce LV)


The AIX logical volume manager(LVM) provides the cplv command, which you can use to copy logical volumes within volume groups or to different volume groups.


Purpose

Copies the contents of a logical volume to a new logical volume.


Syntax

To Copy to a New Logical Volume

cplv [-v VolumeGroup] [-y NewLogicVolume | -Prefix] SourceLogicalVolume

To Copy to an Existing Logical Volume

cplv -e DestinationLogicalVolume [-f] SourceLogicalVolume


Procedure

  1. Identify the logical volume that you want to migrate and the target volume group.
  2. Use the cplv command to migrate data from on logical volume to another
Results

When the command completes processing, a copy of the logical volume is created in the target location.


Description

Attention: Do not copy from a larger logical volume containing data to a smaller one. Doing so results in a corrupted file system because some data(including the superblock) is not copied. This command will fail if the cplv creates a new logical volume and the volume group is varied on in concurrent mode.


note

  1. To use this command, you must either have root user authority or be a member of the system group
  2. If the SourceLogicalVolume is jfs or jfs2 type, the file system must be successfully unmounted and fsck must be run successfully on the newly created file system before the cplv command can be run. If you run the fsck command before mounting the new file system, errors are returned because the log device contained in the superblock would still refer to the original file system. Mount the file system before running fsck so that a new log device is created.

Flags


Item 

Description 

-

Specifies that the DestinationLogicalVolume exists and that a new logical volume should not be create. If the DestinationLogicalVolume is smaller than the SourceLogicalVolume, the extra logical partitions are not copied. For this reason, user confirmation is required, unless the -f flag is added. The Type charcteristic of the DestinationLogicalVolume must be copy to prevent inadvertently overwriting data. To change the Type characteristic, use the chlv command.(#chlv -t copy lv03)

-f

Copies to an existing logical volume without requesting user confirmation.

-v  VolumeGroup

Specifies the volume group where the new logical volume resides. If this is not specified, the new logical volume resides in the same volume group as the SourceLogicalVolume.

-y NewLogicalVolume 

 Specifies the name to use, in place of a system-generated name, for the new logical volume. Logical volume names must be unique systemwide names, and can range from 1 to 15 characters.

-Y Prefix 

Specifies a prefix to use in building a system-generated name for the new logical volume. The prefix must be less than or equal to 13 characters. A name cannot begin with a prefix already defined in the PdDv class in the Device Configuration Database for other devices, or a name already used by another device. 


Example


Here are two examples that show how to use the cplv command to create a new logical volume to overwrite an existing logical volume.


# cplv -v datavg -y newlv oldlv

In this example, the cplv command copies data from the existing logical volume oldlv and creates the new logical volume newly (-y) in the volume group datavg (-v). If you omit the -v option, the new logical volume is added to the same volume group that contained the original logical volume. New volumes that are created by the cplv command maintain the same characteristics as the existing logical volume


# cplv -e existinglv oldlv 

In this example, the cplv command copies data from existing logical volume oldlv to existing logical volume existinglv (-e). When you use the -e option, data in the existing target-logical volume is overwritten with the data from the source-logical volume and the characteristics of the existing target-logical volume are maintained. Use this option with caution.


The cplv command provides a good method for copying or migrating a single logical volume. Sometimes, however, you might need to migrate all of the data from a physical volume.


procedure


Copying a logical volume to exit logical volume within a volume group or a different volume group

  1. Unmount FileSystem

    #umount [FileSystem]
  2. If the filesystem reports it cannot unmount, because it is busy, check to ensure that the application is closed. Then determine which processes are keeping the filesystem from un-mounting; use fuser.

    #fuser -u <filesysetem>

    If you decide you wish to kill all processes on that filesystem, use

    #fuser -k <filesystem>
  3. Change The Type charcteristic of the DestinationLV to copy if you copy source LV to exiting LV

    #chlv -t copy [DestnationLV]

  4. Copy LV

    To copy source LV to exiting LV     #cplv -e [ExitingLV] [SourceLV]

  5. Change mount point

    #chfs -m <new mount point> <original mount point>
  6. Run fsck. you can ignore this step if you have large size filesystem. because it takes very long time. In my case, there is no problem.

    #fsck -p <filesystem>
  7. Mount Filesystem
    #mount [FileSystem]
  8. Remove old LV

    #rm [oldLV]
Copying a logical volume within a volume group or to a different volume group(It will create new logical volume in a volume group that you want to move)
  1. Unmount FileSystem

    #umount [FileSystem]
  2. Copy LV

    To copy source LV to a new LV in a different VG The new LV is created, named, and added to a different VG. A name is made sequentially from fslv00. If you have already fslv00 logical volume, it is named from fslv01.     #cplv -v [dest VG] [SourceLV] #cplv -v [dest VG] -y [New LV name] [Source Lv]

    To copy source LV to a new LV with a VG The new LV is created, placed in the same VG as old LV, and named by the system in series.     #cplv [SourceLV]

  3. Create the jfs2 log.
    #mklv -t [Type] -y [New LV name] [VG name] [number of LPs]
    #logform /dev/[jfs2log LV]
  4. Eidt /etc/filesystems

  5. Run fsck. you can ignore this step if you have large size filesystem. because it takes very long time. In my case, there is no problem.
    #fsck -p [filesystem]
  6. Mount Filesystem
    #mount [FileSystem]
  7. Remove old LV

    #rm [oldLV]


'IBM > AIX' 카테고리의 다른 글

Using the migratepv command  (0) 2016.01.04
AIX Technology Level update strategies  (0) 2015.05.06
Ready for AIX recovery with mksysb and mkdvd  (0) 2015.05.06
Creating a mksysb backup to DVD in AIX V5, V6 and V7  (0) 2015.05.06
^M 없애는 방법  (0) 2014.04.21
반드시알아둘AIX명령  (0) 2012.11.09
P7_OS지원버전  (0) 2012.11.09
savevg  (0) 2012.11.09
randev_디바이스이름변경(AIX7)  (0) 2012.11.09
mpio_get_config  (0) 2012.11.09