07-14-2013 12:06 AM
I would like to move the data from Linear LV to strpped LV on RHEL 5.7.
Is it possible with down time? If yes, Please share the procedures.
Is it possible online? if yes, please share the procedures.
Solved! Go to Solution.
07-15-2013 10:48 AM
Does the LV contain a filesystem, or something else (e.g. a raw database)?
Can you create the striped LV, or must you use a LV that already exists?
I have not tested this, but maybe you could use "lvconvert" to create a striped mirror for the original linear LV? If that is successful, then use "lvconvert" again to remove the non-striped half of the mirror, leaving you with a non-mirrored, striped LV. This might be possible online, without downtime.
If you must move the data to an already-existing LV, then I think some downtime is unavoidable.
The procedure is basically:
- mount the new LV to some temporary location (e.g. /newLV)
- stop applications
- copy everything from the old LV to the new LV, preserving permissions and ownerships (e.g. cp -a /oldLV/* /newLV/)
- make sure the permissions of the root directory of the new LV match the permissions of the root of the old LV (run "ls -ld /oldLV /newLV" and compare. If they are not equal, adjust the ownership/permissions of /newLV.)
- unmount both LVs, edit /etc/fstab, mount the new LV where the old LV used to be
- restart applications
- if everything is OK, remove the old LV.
08-02-2013 10:16 AM
Thanks a lot Matti for your help and support.
Can you please share the command to create the stripped mirror for existing linear LV. So that there will be two mirror copies one will be linear another will be stripped.
08-02-2013 01:27 PM
I created a Virtual Machine and tested this. Looks like it works.
When you're striping a LV, you obviously must have two or more PVs to stripe it to; otherwise you would gain nothing from striping. So, let's say that you have the original PV as /dev/sda and you want the striped version to go to /dev/sdb and /dev/sdc. In this example, the LV that you want to stripe is /dev/vgtest/lvol0.
Here is the command to create the striped mirror:
lvconvert -m 1 --mirrorlog core --stripes 2 /dev/vgtest/lvol0 /dev/sdb /dev/sdc
The number to the --stripes option must be equal to the number of PVs listed.
The default stripe size is 64 KB. You can adjust it with the --stripesize option if you wish.
The "--mirrorlog core" is dangerous: it might be OK for small and short-lived mirrors only, and only if your system is protected from power interruptions (= has an UPS). But it makes things simpler for testing and conversions, when the mirror is removed immediately after its creation is completed.
If you use disk-based mirror log instead (--mirrorlog disk or --mirrorlog mirrored), you will need one or two small extra PVs in the VG for the mirror logs, as LVM won't allocate space for the mirror log on PVs that will contain any of the actual LV mirror components.
And here is the command to remove the original non-striped mirror:
lvconvert -m 0 /dev/vgtest/lvol0 /dev/sda
If after the first step you want to roll back and remove the striped mirror instead:
lvconvert -m 0 /dev/vgtest/lvol0 /dev/sdb /dev/sdc