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.
About this task
The migratepv command moves allocated physical partitions and the data
they contain from the source physical volume to one or more destination
physical volumes and has the following syntax: migratepv
-lv
LogicalVolume
SourcePhysicalVolume
DestinationPhysicalVolume. 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
Procedure
- 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 space 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, which are more than 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 output
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 command
LV 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
# 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
-
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
Results
After 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.