LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-13-2017, 07:59 AM   #1
tmart837
LQ Newbie
 
Registered: Dec 2017
Posts: 3

Rep: Reputation: Disabled
LVM mirroring using lvconvert


Hello,
We need to migrate to a new storage frame and i'd like to do it with no/little downtime. The existing vg contains 1 lv that is spread across 4 disk devices. I have allocated and added 1 new disk to the vg that I want to migrate to. I used lvconvert to do this. Once lvconvert showed 100% sync I then used lvconvert to pull the original 4 drives. After, the vgdisplay command shows the vg/lv on the original and the new device empty. Any suggestions on what i'm doing wrong and how I can get this done? Here are the commands I used:

lvconvert -m 1 vgname/lvname /dev/mapper/mpathg

after sync:
lvconvert -m 0 vgname/lvname /dev/mapper/mpathp
lvconvert -m 0 vgname/lvname /dev/mapper/mpathk
lvconvert -m 0 vgname/lvname /dev/mapper/mpathr
lvconvert -m 0 vgname/lvname /dev/mapper/mpaths

The server is running RedHat 6.4

Thanks,
Tom.
 
Old 12-13-2017, 08:14 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
For multiple PVs on the same LV use one line to remove them from the mirror:
Code:
lvconvert -m 0 vgname/lvname /dev/mapper/mpathp /dev/mapper/mpathk /dev/mapper/mpathr /dev/mapper/mpaths
When we did a similar migration last year I found that any typo in the "lvconvert -m 0" makes it go back to the first (original) mirror device(s) rather than keeping the new mirror. Quite maddening on some of the things I did that were 7 TB and took hours to create the new mirror.
 
1 members found this post helpful.
Old 12-13-2017, 09:43 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Mirroring and then removing the original is basically what pvmove does.
 
Old 12-13-2017, 10:30 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by rknichols View Post
Mirroring and then removing the original is basically what pvmove does.
There is benefit to using lvconvert vs pvmove:
1) You can background the lvcconvert and periodically check its status.
2) You can work with multiple LVs more easily.
3) If something happens in the middle of the lvconvert your original extents are still in place until you decide to remove the extents on the new volumes.

pvmove is something I've used a few times for one off things (e.g. moving from a smaller volume to a larger one) but for a project where one is migrating from one disk array to another where multiple servers, multiple VGs and multiple LVs are concerned lvconvert is the way to go IMO.
 
Old 12-13-2017, 11:22 AM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
If you don't restrict it to one LV, pvmove will happily move all the LVs in the source PV. If there is a crash during the operation, just running "pvmove" again with no physical volume arguments will restart all moves in progress from the last checkpoint. You can use the "--atomic" option to ensure that everything remains as it was on the source PV if the operation is aborted. You can use the "--background" option to run the pvmove daemon in the background.

Yes, you can do it all manually with lvconvert, just as you can use dmsetup directly to make COW snapshots without involving LVM. Generally, using the higher-level tools makes more sense to me unless there is some overriding reason that prevents it.
 
Old 12-13-2017, 03:15 PM   #6
tmart837
LQ Newbie
 
Registered: Dec 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MensaWater View Post
For multiple PVs on the same LV use one line to remove them from the mirror:
Code:
lvconvert -m 0 vgname/lvname /dev/mapper/mpathp /dev/mapper/mpathk /dev/mapper/mpathr /dev/mapper/mpaths
When we did a similar migration last year I found that any typo in the "lvconvert -m 0" makes it go back to the first (original) mirror device(s) rather than keeping the new mirror. Quite maddening on some of the things I did that were 7 TB and took hours to create the new mirror.


Thank you, this worked.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Mirroring in LVM devUnix Linux - Server 7 03-14-2012 01:24 PM
Existing LVM filesystem to software RAID 0 (mirroring) hellowe Linux - Server 8 11-25-2009 07:28 AM
LVM mirroring jkboys Linux - Newbie 0 07-08-2008 02:22 PM
LVM mirroring two volumes sebstar Linux - Server 4 02-17-2008 05:07 PM
LVM and lvextend mirroring smkamene Linux - Software 0 02-26-2005 08:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration