Operating System - Linux
1752805 Members
5688 Online
108789 Solutions
New Discussion

Need to move the data from Linear LV to stripped LV on RHEL 5.7

 
Go to solution
Senthil_N
Advisor

Need to move the data from Linear LV to stripped LV on RHEL 5.7

Hi All,

 

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.

6 REPLIES 6
Senthil_N
Advisor

Re: Need to move the data from Linear LV to stripped LV on RHEL 5.7

Hi All,

Could you please any one reply to this.
Matti_Kurkela
Honored Contributor

Re: Need to move the data from Linear LV to stripped LV on RHEL 5.7

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.
MK
Senthil_N
Advisor

Re: Need to move the data from Linear LV to stripped LV on RHEL 5.7

Hi Matti,

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.
Matti_Kurkela
Honored Contributor
Solution

Re: Need to move the data from Linear LV to stripped LV on RHEL 5.7

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

 

MK
Senthil_N
Advisor

Re: Need to move the data from Linear LV to stripped LV on RHEL 5.7

Hi Matti,

Thanks a lot for giving solution.
midgard
New Member

Re: Need to move the data from Linear LV to stripped LV on RHEL 5.7

what if I have a vg with size of 3Tb in striped (10 disk aprox) and I added by mistake one disk with 300G into the VG but liner, do i have to get 3T to make the mirror?

 

thanks in advance.