With the AIX LVM migratelp command, individual physical partitions can be exchanged in a logical volume. The article will take a closer look at how the migratelp command works.
Our Test Environment
We created a scalable volume group vg00 in our test environment. Nine physical volumes are available for the VG vg00, which are provided by 3 different data centers:
- hdisk10, hdisk11 and hdisk12 (green) from data center DC01
- hdisk13, hdisk14 and hdisk15 (red) from data center DC02
- hdisk16, hdisk17 and hdisk18 (blue) from data center DC03
The Command migratelp
The syntax of the migratelp command is:
migratelp lv/lp[/copy] pv[/pp]
It moves exactly one physical partition to the specified target physical volume(s) pv. The source physical partition is specified as lv/lp (logical volume, logical partition number, copy 1) or as lv/lp/copy ( Logical Volume, Logical Partition Number, Copy Number). Optionally, the desired physical partition number can be specified on the target physical volume. E.g.:
migratelp lv01/109/2 hdisk17
1st Case: Unmirrored Logical Volume
We create a small LV (10 LPs) with the following mapping file:
# cat unmirrored.map
hdisk10:1-3
hdisk14:1-3
hdisk12:1-3
hdisk14:4
# mklv -m unmirrored.map vg00 10
lv00
#
The resulting logical volume then looks like this:
The first 3 physical partitions are on hdisk10 (DC01), the next 3 physical partitions are on hdisk14 (DC02), etc.
The 4 physical partitions on hdisk14 (0004, 0005, 0006 and 0010) are to be moved to hdisk11 (DC01).
We only show moving one physical partition. The command for other partitions is similar. We follow the work of migratelp graphically below.
# migratelp lv00/4 hdisk11
The resulting logical volume then looks like this:
# lslv -m lv00
lv00:N/A
LP PP1 PV1 PP2 PV2 PP3 PV3
0001 0001 hdisk10
0002 0002 hdisk10
0003 0003 hdisk10
0004 0009 hdisk11
0005 0002 hdisk14
0006 0003 hdisk14
0007 0001 hdisk12
0008 0002 hdisk12
0009 0003 hdisk12
0010 0004 hdisk14
#
The first and only copy of LP 0004 is now on hdisk11 (DC01). Similarly, you can move the other physical partitions from hdisk14 (DC02) to hdisk11 (DC01). With the migratepv command it is of course much easier!
The command migratelp works in the case of an unmirrored logical volume in the following way:
- Adding a second mirror copy for the logical partition to be moved on the target physical volume.
- Synchronization of the new mirror copy.
- Replace the first mirror copy with the second mirror copy.
2nd Case: Mirrored Logical Volume (2 Copies)
We create a small LV (10 LPs) with the following mapping file:
# cat mirrored.map
hdisk10:1-3
hdisk14:1-3
hdisk10:4-6
hdisk14:4
hdisk13:1-3
hdisk11:1-3
hdisk13:4-6
hdisk11:4
# mklv -c 2 —m mirrored.map vg00 10
lv00
#
This is the resulting logical volume:
# lslv -m lv00
lv00:N/A
LP PP1 PV1 PP2 PV2 PP3 PV3
0001 0001 hdisk10 0001 hdisk13
0002 0002 hdisk10 0002 hdisk13
0003 0003 hdisk10 0003 hdisk13
0004 0001 hdisk14 0001 hdisk11
0005 0002 hdisk14 0002 hdisk11
0006 0003 hdisk14 0003 hdisk11
0007 0004 hdisk10 0004 hdisk13
0008 0005 hdisk10 0005 hdisk13
0009 0006 hdisk10 0006 hdisk13
0010 0004 hdisk14 0004 hdisk11
#
With mirrored LVs, migratelp temporarily creates again an additional mirror copy. In the case of mirrored LVs, the way migratelp works depends on whether mirror copy 1 or mirror copy 2 of a logical partition is moved.
- Variant 1: If mirror copy 1 is moved to another physical volume, the additional mirror copy is inserted before mirror copy 1. This means that the existing mirror copy 1 becomes copy 2 and the existing mirror copy 2 becomes copy 3.
- Variant 2: If mirror copy 2 is moved to another physical volume, the additional mirror copy is added at the end as before and is in this case copy 3.
Variant 1
We will first take a closer look at variant 1. For this we move the first copy of the logical partition 0004 from hdisk14 (DC02) to hdisk12 (DC01).
We follow the work of migratelp graphically again.
# migratelp lv00/4 hdisk12
The resulting logical volume looks like this:
# lslv -m lv00
lv00:N/A
LP PP1 PV1 PP2 PV2 PP3 PV3
0001 0001 hdisk10 0001 hdisk13
0002 0002 hdisk10 0002 hdisk13
0003 0003 hdisk10 0003 hdisk13
0004 0009 hdisk12 0001 hdisk11
0005 0010 hdisk14 0002 hdisk11
0006 0011 hdisk14 0003 hdisk11
0007 0004 hdisk10 0004 hdisk13
0008 0005 hdisk10 0005 hdisk13
0009 0006 hdisk10 0006 hdisk13
0010 0012 hdisk14 0004 hdisk11
#
The first copy of LP 0004 is now on hdisk12 (DC01).
The command migratelp works in the case of a mirrored LV (2 copies) when moving a physical partition in mirror copy 1:
- Mirror copy 2 becomes copy 3 and mirror copy 1 becomes copy 2. The physical partition to be replaced is now in mirror copy 2, no longer in mirror copy 1!
- Insertion of the physical partition on the target physical volume as mirror copy 1.
- Synchronizing the new mirror copy 1.
- Replace mirror copy 2 with copy 3.
Variant 2
Variant 2, in which the second mirror copy is moved, is similar to the non-mirrored case. To do this, we move the second copy of logical partition 0004 from hdisk11 (DC01) to hdisk15 (DC02).
Again, we follow the work of migratelp graphically.
# migratelp lv00/4/2 hdisk15
Then, the resulting logical volume looks like this:
# lslv -m lv00
lv00:N/A
LP PP1 PV1 PP2 PV2 PP3 PV3
0001 0001 hdisk10 0001 hdisk13
0002 0002 hdisk10 0002 hdisk13
0003 0003 hdisk10 0003 hdisk13
0004 0001 hdisk14 0009 hdisk15
0005 0002 hdisk14 0002 hdisk11
0006 0003 hdisk14 0003 hdisk11
0007 0004 hdisk10 0004 hdisk13
0008 0005 hdisk10 0005 hdisk13
0009 0006 hdisk10 0006 hdisk13
0010 0004 hdisk14 0004 hdisk11
#
The second copy of LP 0004 is now on hdisk15 (DC02).
The command migratelp works in the case of a mirrored LV (2 copies) when moving a physical partition in the mirror copy 2 in the following way:
- Adding mirror copy 3 on the destination physical volume.
- Synchronize the new mirror copy 3.
- Replace mirror copy 2 with mirror copy 3.
The case of a logical volume with 3 mirror copies is considered in a separate article.
Mirror Pools and migratelp
The migratelp command does not check whether the selected target physical volume is in the correct mirror pool!
You must be logged in to post a comment.