LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 02-09-2012, 04:06 PM   #1
davidcH
LQ Newbie
 
Registered: Feb 2012
Posts: 3

Rep: Reputation: Disabled
Time-efficient LVM snapshot migration


Hi there,

I use Xen and LVM to manage the disks attached to the virtualised machines. The logical volumes reside on a SAN which is connected to the virtualisation server by iSCSI.

If I want to move a VM's logical volume from one SAN to another I currently shutdown the VM, dd the LV to the other SAN, update the VM's config to point to the new location of the LV and boot back up.

This works but the only problem is that the amount of time that the VM is offline is proportional to the amount of data transferring.

What I wondered is if anyone could recommend a better way that minimised this offline period? I wondered if maybe I could take an LV snapshot, migrate that whilst the VM was still online, shutdown, migrate and merge changes/differences on the LV and then startup? This would then make the offline period proportional to the amount of changed data which would be much smaller.

Anyway, I hope that this makes sense and welcome your thoughts, suggestions and questions.

Cheers,

David.
 
Old 02-09-2012, 04:50 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Yes, you could create an LVM snapshot of the filesystem, and then dump(8) the snapshot to a location of your choice. That way the (source) filesystem can remain live while you migrate it.
 
Old 02-09-2012, 05:06 PM   #3
davidcH
LQ Newbie
 
Registered: Feb 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Whilst transferring the snapshot the live LV will obviously be changed by the live VM. Is there some way to then turn off the VM and dd the changes/differences between the LV state and the snapshot state?
 
Old 02-10-2012, 01:25 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
That's the point of snapshotting the LV filesystem -- getting a snapshot and allowing you to have a consistent backup, in spite of a changing filesystem.

But I believe I see what you're saying: you want the changes (post-snapshot) to also be applied to VM you're migrating to, correct? And you want this to all happen with minimal - or no - downtime?

If so (and assuming I understand your needs), what you may really want is block-level replication. I haven't had a chance to tinker with DRBD yet, but it looks to be stable and well regarded.
 
Old 02-10-2012, 08:25 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,551
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Alternatively, it might be worth exploring using rsync to update the copied snapshot with the differences the VM made during the copying ...
  1. Shut down VM
  2. Make LV snapshot
  3. Start VM
  4. Copy the snapshot to the other SAN
  5. Shut down VM
  6. rsync the LV to the copy on the other SAN (key question -- how long does this take?)
  7. Reconfigure the VM to use the other SAN
  8. Start VM
  9. If all is well, drop the snapshot
 
Old 02-16-2012, 09:48 AM   #6
davidcH
LQ Newbie
 
Registered: Feb 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
I just wanted to let you know that I found the solution to this shortly after posting here. Testing has worked well and I will be using lvmsync (http://theshed.hezmatt.org/lvmsync/) for this.
 
Old 02-16-2012, 10:17 AM   #7
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Good find.
 
Old 02-16-2012, 10:28 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,551
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Glad you found a solution and thanks for the link

Threads can be marked SOLVED via the Thread Tools menu.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] what is a LVM snapshot? aceone Red Hat 6 05-22-2010 12:08 PM
LVM Snapshot eldo Linux - Server 2 11-20-2009 04:10 AM
lvm snapshot Ammad Linux - General 1 02-18-2009 07:03 AM
LVM snapshot(configuring backup time) abhishekrahel Linux - General 1 10-07-2008 10:28 PM
About LVM Snapshot geethusari LinuxQuestions.org Member Intro 1 12-03-2007 07:11 AM


All times are GMT -5. The time now is 01:15 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration