Need to move the data from Linear LV to stripped LV on RHEL 5.7 (921 Views)
Reply
Advisor
Senthil_N
Posts: 28
Registered: ‎03-04-2013
Message 1 of 6 (921 Views)
Accepted Solution

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.

Advisor
Senthil_N
Posts: 28
Registered: ‎03-04-2013
Message 2 of 6 (898 Views)

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.
Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 3 of 6 (890 Views)

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
Advisor
Senthil_N
Posts: 28
Registered: ‎03-04-2013
Message 4 of 6 (869 Views)

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.
Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 5 of 6 (866 Views)

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
Advisor
Senthil_N
Posts: 28
Registered: ‎03-04-2013
Message 6 of 6 (786 Views)

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

Hi Matti,

Thanks a lot for giving solution.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.