Using the migratepv command(source disk to destination disks that is larger than it)
You can use the logical volume manager(LVM) migratepv command to migrate data that is on physical volumes, Because you can use this command while the system is active, users are not disrupted.
Purpose
Moves allocated physical partitions from one physical volume to one or more other physical volumes
Syntax
migratepv [-lv LogicalVolume] SourcePhysicalVolume DestinationPhysicalVolume...
Flags
Flag name |
Description |
-lv |
Moves only the physical partitions allocated to the specified logical volume and located on th specified source physical volume |
Exit Status
Return code |
Description |
8 |
The physical volume is not assigned to a volume group |
Examples
- To move physical partitions from hdisk1 to hdisk6 and hdisk7, type:
#migratepv hdisk1 hdisk6 hdisk7
Physical partitions are moved from one physical volume to two others within the same volume group. - To move physical partitions in logical volume lv02 from hdisk1 to hdisk6, type:
#migratepv -lv lv02 hdisk1 hdisk6
Only those physical partitions contained in lv02 are moved from one physical volume to another.
About this task
The migratepv command moves allocated physical partitions and the data they contain from the source physical volume to one or more destnation physical volumes and had the following syntax: migratepv -lv LogicalVolume SourcePhysicalVolume DestnationPhysicalVolume. The specified physical volumes must all be in the same volume group. The specified source physical volume cannot be included in the list of destination physical volume parameters.
The migratepv command migrates data by completing these actions:
- Creates a mirror of the logical volumes that you are moving
- Synchronizes the logical volumes
- Removes the original logical volume
- Identify the source disk that contains the data and its volume group.
Example: Using the lsdev command# lsdev -Cc disk hdisk0 Available 04-08-00-8,0 16 Bit LVD SCSI Disk Drive <== choose hdisk0 as source disk hdisk1 Available 04-08-01-8,0 16 Bit LVD SCSI Disk Drive hdisk2 Available 06-09-02 IBM FC 2107
- Calculate the amount of spcae that is in use on the disk. The calculation is the total number of physical partitions(PPS) minus the number of free partitions on the disk. In the following example, disk hdisk0 is a member of the rootvg volume group and is using 279 PPs(542 - 263 = 279).
Example: Using the lsvg command# lsvg -p rootvg rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 542 263 78..00..00..76..109
- Identify destination disk or disks that have enough empty space to accommodate the copied data. If the destination disk or disks are not in same volume group as the source disk, do the following action. Add the destination disk to the source disk volume group with the extendvg command. For instance, extendvg rootvg hdisk1. In the following example, disks hdisk0 and hdisk1 are in same volume group. The destination disk hdisk1 has 542 free PPs, whic are more that the 279 PPs needed.
Example: Using the lsvg command# lsvg -p rootvg;date rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 542 263 78..00..00..76..109 hdisk1 active 542 542 109..108..108..108..109
- You must verify whether the volume group boot image is on the physical volume that you are moving. You must first Identify the name of the logical volume that contains the boot image. Issue the lsvg -l rootvg command to identify the name of the logical volume that contains the volume group boot image. In this example, partial outpu listing for the lsvg -l rootvg command shows that for the rootvg volume group, logical volume hd5 has the boot type.
Example: Output of the lsvg commandLV NAME TYPE Ps PPs PVs LV STATE MOUNT POINT hd5 boot 1 1 1 closed/syncd N/A
- Enter the lslv -l command to determine whether the boot image is on the source disk. The following example displays the output of the lslv -l command. In this case, logical hd5 is on disk hdisk0, which is the source disk.
Example: Output of lslv command# lslv -l hd5 hd5:N/A PV COPIES IN BAND DISTRIBUTION hdisk0 001:000:000 100% 001:000:000:000:000
- If the source disk contains the boot image, complete these substeps to transfer that boot image to the destination disk.
- Issue migratepv -lv hd5 hdisk0 hdisk1 to move the physical partitions in logical volume hd5 that contain the boot image from source disk hdisk0 to destination disk hdisk1.
- Issue chpv -c hdisk0 as root user to delete the boot record from the source disk to avoid a potential boot from the old boot image.
- Issue the bosboot command to establish disk hdisk1 as the new boot disk.
- Issue the bootlist command to designate disk hdisk1, which now contains the boot image, as the boot disk in the boot list. Example: Using the migratepv command
- Issue the migratepv command to migrate the data from one physical volume to another. Then, you can enter the lsvg -p command to verify the results. In this example, migration is completed and hdisk0 shows 0 PPs because all physical volume data that was on hdisk0 is moved to hdisk1.
Example: Using the migratepv command# migratepv hdisk0 hdisk1 # echo $? 0 # lsvg -p rootvg rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 542 542 109..108..108..108..109 hdisk1 active 542 263 30..15..01..108..109
- After the operation completes, enter the reducevg command to remove the source physical volume from the volume group. In this example, remove physical volume hdisk0 from volume group rootvg.
Example: Using the reducevg command# reducevg rootvg hdisk0 # echo $? 0 # lsvg -p rootvg rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk1 active 542 263 30..15..01..108..109
# migratepv -l hd5 hdisk0 hdisk1 0516-1011 migratepv: Logical volume hd5 is labeled as a boot logical volume. 0516-1246 migratepv: If hd5 is the boot logical volume, please run 'chpv -c hdisk0' as root user to clear the boot record and avoid a potential boot off an old boot image that may reside on the disk from which this logical volume is moved/removed. migratepv: boot logical volume hd5 migrated. Please remember to run bosboot, specifying /dev/hdisk1 as the target physical boot device. Also, run bootlist command to modify bootlist to include /dev/hdisk1. <<< the following commands taken based on the warning after migrated the boot device # chpv -c hdisk0 # echo $? 0 # bosboot -ad /dev/hdisk1 bosboot: Boot image is 49180 512 byte blocks. # echo $? 0 # bootlist -m normal -o hdisk1 hdisk1 blv=hd5 pathid=0
ResultsAfter processing is complete, the physical volume is copied to the new location and the LVM no longer accesses the original volume to locate the data that was stored there.
https://www-01.ibm.com/support/knowledgecenter/HW213_7.4.0/com.ibm.storage.ssic.help.doc/f2c_usinglvmmigratepv_1cuan8.html?lang=en
'IBM > AIX' 카테고리의 다른 글
Copying a complete logical volume (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 |