Copying a complete logical volume
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.Procedure
Identify the logical volume that you want to migrate and the target volume group.Use the cplv command to migrate data from one logical volume to another.
Results
When the command completes processing, a copy of the logical volume is created in the target location.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 newlv (-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.
These are the steps I follow for copying logical volumes:
Step 1: umount [filesystem]
Step 2: cp [oldLV] [newLV]
cplv –v VG(destination) –y [newLV] [sourceLV]
Step 3: chfs to recognize [newLV]
chfs –a dev=/dev/[newLV] –a log=/dev/[logdev] /[filesystem]
Step 4: fsck –p /dev/[newLV]
Step 5: mount [filesystem]
Step 6: rm [oldLV]
Step 2: cp [oldLV] [newLV]
cplv –v VG(destination) –y [newLV] [sourceLV]
Step 3: chfs to recognize [newLV]
chfs –a dev=/dev/[newLV] –a log=/dev/[logdev] /[filesystem]
Step 4: fsck –p /dev/[newLV]
Step 5: mount [filesystem]
Step 6: rm [oldLV]
No comments:
Post a Comment