* Re: [linux-lvm] Copy LVs
2007-09-26 9:50 [linux-lvm] Copy LVs Peter Larsen
@ 2007-09-26 14:18 ` Stuart D. Gathman
2007-09-26 16:08 ` Chris Cox
1 sibling, 0 replies; 3+ messages in thread
From: Stuart D. Gathman @ 2007-09-26 14:18 UTC (permalink / raw)
To: LVM general discussion and development
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.
^ permalink raw reply [flat|nested] 3+ messages in thread