Re: Copy LVs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 26 Sep 2007, Peter Larsen wrote:

> What's the "official" procedure of cloning Volume Groups or Logical
> Volumes across systems?
> 
> Let's say I want to clone the OS to a new box. Do I dd everything over,
> or is there a better "lvm" way?

Pardon a little "blue sky" here.  There is a better way that is easy
to script for a particular case, but there is no robust general purpose
script for linux - yet.  This description is patterned off of AIX vgsave.

1) From source vg, write text description of all logical volumes.  Keep in
   mind that "vgrest" has to parse it reliably - so simply copying the
   VG metadata, already in text form for LVM2, is not necessarily the
   best approach.  For one, I would write a script that creates 
   logical volumes with the same names and sizes.  For two, the description
   needs additional metadata similar to that collected by a linux installer -
   where LV is mounted, filesystem type, swap partition, etc.
   I can see creating a directly executable shell script here, or perhaps
   XML or other structured data and a python script to parse and execute it.

2) Create target VG, and create all logical volumes from script/data.
   (Optional - resize file system LVs to minimum required to restore archive.)

3) rsync, or tar and untar (preserving extended attributes) each 
   logical volume, format swap partitions.

When cloning to a tape, write the VG metadata (or simplified description)
first, followed by tar archives of each LV.  AIX saves only mounted LVs,
and creates one big archive, remembering where each LV was mounted in the
metadata.  I'm not convinced that is the best approach.

In short, something like vgsave and vgrest that could clone a VG directly
to a target and/or to tape/archive file would be a great addition to LVM.
I will even write it, but it will be at least 6 months before I can get
past a lot of system upgrades - so feel free to beat me to it.

-- 
	      Stuart D. Gathman <stuart@bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux