linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Copying LVM from one system to another
@ 2006-07-10 14:01 Shaun Mccullagh
  2006-07-10 17:18 ` Ming Zhang
  0 siblings, 1 reply; 7+ messages in thread
From: Shaun Mccullagh @ 2006-07-10 14:01 UTC (permalink / raw)
  To: linux-lvm

Hi,

I would like to copy an entire volume group to another PC with identical
hardware and the same disc config.

I would like to do this using a method like this:

Boot destination PC from a USB stick with a full copy of RH ES v4 on it.

Create a Volume Group and all necessary Logical Volumes etc on
destination hard discs so that they are the same sizes as on the source.
All the filesystems associated with these logical volumes will be mount
under /restore.

Restore all the data that was on the source to the destination to
/restore.

Note that /restore/boot is a small primary partition.

Once I have done this, do I copy /etc/lvm to /restore/etc/lvm, and then
chroot /restore, then do vgscan? Finally label the discs, exec grub,
then reboot

I guess the last bit is wrong?

TIA

Shaun





Op dit e-mailbericht is een disclaimer van toepassing, welke te vinden is op http://www.xb.nl/disclaimer.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [linux-lvm] Copying LVM from one system to another
  2006-07-10 14:01 [linux-lvm] Copying LVM from one system to another Shaun Mccullagh
@ 2006-07-10 17:18 ` Ming Zhang
  2006-07-11 17:48   ` Dieter Stüken
  0 siblings, 1 reply; 7+ messages in thread
From: Ming Zhang @ 2006-07-10 17:18 UTC (permalink / raw)
  To: LVM general discussion and development

if HW is the same, why not use ghost or alike software to do a clone?

Ming

On Mon, 2006-07-10 at 16:01 +0200, Shaun Mccullagh wrote:
> Hi,
> 
> I would like to copy an entire volume group to another PC with identical
> hardware and the same disc config.
> 
> I would like to do this using a method like this:
> 
> Boot destination PC from a USB stick with a full copy of RH ES v4 on it.
> 
> Create a Volume Group and all necessary Logical Volumes etc on
> destination hard discs so that they are the same sizes as on the source.
> All the filesystems associated with these logical volumes will be mount
> under /restore.
> 
> Restore all the data that was on the source to the destination to
> /restore.
> 
> Note that /restore/boot is a small primary partition.
> 
> Once I have done this, do I copy /etc/lvm to /restore/etc/lvm, and then
> chroot /restore, then do vgscan? Finally label the discs, exec grub,
> then reboot
> 
> I guess the last bit is wrong?
> 
> TIA
> 
> Shaun
> 
> 
> 
> 
> 
> Op dit e-mailbericht is een disclaimer van toepassing, welke te vinden is op http://www.xb.nl/disclaimer.html
> 
> 
> 
> 
> _______________________________________________
> 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/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [linux-lvm] Copying LVM from one system to another
  2006-07-10 17:18 ` Ming Zhang
@ 2006-07-11 17:48   ` Dieter Stüken
  2006-07-11 18:03     ` Shaun Mccullagh
  2006-07-11 18:10     ` Ming Zhang
  0 siblings, 2 replies; 7+ messages in thread
From: Dieter Stüken @ 2006-07-11 17:48 UTC (permalink / raw)
  To: mingz, LVM general discussion and development

Ming Zhang wrote:
> if HW is the same, why not use ghost or alike software to do a clone?

Don't "clone" the LVM PVs if you ever want to connect both disks simultaneously.
For normal partitions this is fine, as those are identified by the device
name. So you can easily distinguish /dev/hda1 from /dev/hdc1.

LVM however identifies the different VG/LV/PV by its content, regardless of
where the disks are connected. If you connect your LVM disk to a different
cable or controller, don't worry, it will be found automatically. If two disks,
however, look exactly the same, LVM gets confused. 

Instead you should connect both disk:

arrange booting from <newdisk>,
lvm from <olddisk> should still work, even if connected differently.

pvcreate <new disk>
vgextend <new disk>
pvmove <olddisk>
vgreduce <olddisk>

to migrate all LVM content to the new disk.

Dieter.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [linux-lvm] Copying LVM from one system to another
  2006-07-11 17:48   ` Dieter Stüken
@ 2006-07-11 18:03     ` Shaun Mccullagh
  2006-07-11 19:12       ` Dieter Stüken
  2006-07-11 18:10     ` Ming Zhang
  1 sibling, 1 reply; 7+ messages in thread
From: Shaun Mccullagh @ 2006-07-11 18:03 UTC (permalink / raw)
  To: LVM general discussion and development

Dieter,

Thanks very much, but the problem is I want be able to restore my LVM filesystems from a backup. This is why I came with the idea of booting the PC I want to restore from a USB stick. The idea is the stick has a copy of the backup client. The LVM filesystems are mounted under /restore and I restore all the data to /restore.

How do I tell LVM the data has moved? I've experimented using this method but I noticed devmapper complains when I boot the PC from the newly restored data.

Cheers

Shaun

-----Original Message-----
From: linux-lvm-bounces@redhat.com [mailto:linux-lvm-bounces@redhat.com] On Behalf Of Dieter St�ken
Sent: dinsdag 11 juli 2006 19:49
To: mingz@ele.uri.edu; LVM general discussion and development
Subject: Re: [linux-lvm] Copying LVM from one system to another

Ming Zhang wrote:
> if HW is the same, why not use ghost or alike software to do a clone?

Don't "clone" the LVM PVs if you ever want to connect both disks simultaneously.
For normal partitions this is fine, as those are identified by the device
name. So you can easily distinguish /dev/hda1 from /dev/hdc1.

LVM however identifies the different VG/LV/PV by its content, regardless of
where the disks are connected. If you connect your LVM disk to a different
cable or controller, don't worry, it will be found automatically. If two disks,
however, look exactly the same, LVM gets confused. 

Instead you should connect both disk:

arrange booting from <newdisk>,
lvm from <olddisk> should still work, even if connected differently.

pvcreate <new disk>
vgextend <new disk>
pvmove <olddisk>
vgreduce <olddisk>

to migrate all LVM content to the new disk.

Dieter.

_______________________________________________
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/




Op dit e-mailbericht is een disclaimer van toepassing, welke te vinden is op http://www.xb.nl/disclaimer.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [linux-lvm] Copying LVM from one system to another
  2006-07-11 17:48   ` Dieter Stüken
  2006-07-11 18:03     ` Shaun Mccullagh
@ 2006-07-11 18:10     ` Ming Zhang
  1 sibling, 0 replies; 7+ messages in thread
From: Ming Zhang @ 2006-07-11 18:10 UTC (permalink / raw)
  To: Dieter Stüken; +Cc: LVM general discussion and development

yes, you are right for migrating the content from one disk to another
disk.

but in his case, he want to migrate to another system, with same cpu,
ram, disk,...

that is why i think clone is ok.

Ming

On Tue, 2006-07-11 at 19:48 +0200, Dieter Stüken wrote:
> Ming Zhang wrote:
> > if HW is the same, why not use ghost or alike software to do a clone?
> 
> Don't "clone" the LVM PVs if you ever want to connect both disks simultaneously.
> For normal partitions this is fine, as those are identified by the device
> name. So you can easily distinguish /dev/hda1 from /dev/hdc1.
> 
> LVM however identifies the different VG/LV/PV by its content, regardless of
> where the disks are connected. If you connect your LVM disk to a different
> cable or controller, don't worry, it will be found automatically. If two disks,
> however, look exactly the same, LVM gets confused. 
> 
> Instead you should connect both disk:
> 
> arrange booting from <newdisk>,
> lvm from <olddisk> should still work, even if connected differently.
> 
> pvcreate <new disk>
> vgextend <new disk>
> pvmove <olddisk>
> vgreduce <olddisk>
> 
> to migrate all LVM content to the new disk.
> 
> Dieter.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [linux-lvm] Copying LVM from one system to another
  2006-07-11 18:03     ` Shaun Mccullagh
@ 2006-07-11 19:12       ` Dieter Stüken
  2006-07-11 19:50         ` Shaun Mccullagh
  0 siblings, 1 reply; 7+ messages in thread
From: Dieter Stüken @ 2006-07-11 19:12 UTC (permalink / raw)
  To: LVM general discussion and development

Shaun Mccullagh wrote:
> Thanks very much, but the problem is I want be able to restore my LVM filesystems from a backup. 
> This is why I came with the idea of booting the PC I want to restore from a USB stick. 
> The idea is the stick has a copy of the backup client. The LVM filesystems are mounted under 
> /restore and I restore all the data to /restore.
> 
> How do I tell LVM the data has moved? I've experimented using this method but I noticed devmapper 
> complains when I boot the PC from the newly restored data.

Do you have any concrete error message, which give a hint about what goes wrong?

If you mount a file system, the mount command first looks into /etc/fstab to find
the device to mount. So you may configure your mount points by editing /etc/fstab.

This is very different with LVM! There is no such configuration that determines your
LVM layout. Instead all data describing the layout of your LVM is saved on the LVM
disk(s) them self! When LVM starts up, it scans all disks to find for LVM informations.
If all this configurations are consistent (if you have several LVM disk), the VGs and
LVs are registered by name, regardless on which device they are found. 
LVM then writes a protocol of all it found to /etc/lvm/backup. 
Changing the configuration is not as easy as editing some config file, 
as there is no such thing! Instead it is not necessary at all.

In your case, I would suggest to create an independent volume group on the other
disk with a different VG-name. The LVs may have the same names on both VGs.
If you put them into different hosts, you may synchronize/backup them via network.
Else you may put both VGs into the same hosts without problems, mounting the LVs manually
and copy the data directly.

Don't worry about any config-files to save. You may connect any LVM disk to any IDE
port and it should be recognized automatically.

If you move an VG from one host to an other, you should do an "vgexport" first.
I don't know if this is still necessary with LVM2. I accidentally moved VGs back
and forth even without using lvexport and did not found a problem.

Dieter.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [linux-lvm] Copying LVM from one system to another
  2006-07-11 19:12       ` Dieter Stüken
@ 2006-07-11 19:50         ` Shaun Mccullagh
  0 siblings, 0 replies; 7+ messages in thread
From: Shaun Mccullagh @ 2006-07-11 19:50 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]

Hi Dieter,
 
I will try this idea out and post the results to the list. 
 
Many thanks
 
Shaun


In your case, I would suggest to create an independent volume group on the other
disk with a different VG-name. The LVs may have the same names on both VGs.
If you put them into different hosts, you may synchronize/backup them via network.
Else you may put both VGs into the same hosts without problems, mounting the LVs manually
and copy the data directly.

Don't worry about any config-files to save. You may connect any LVM disk to any IDE
port and it should be recognized automatically.

If you move an VG from one host to an other, you should do an "vgexport" first.
I don't know if this is still necessary with LVM2. I accidentally moved VGs back
and forth even without using lvexport and did not found a problem.

Dieter.

_______________________________________________
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/





Op dit e-mailbericht is een disclaimer van toepassing, welke te vinden is op http://www.xb.nl/disclaimer.html




[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 4103 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-07-11 20:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-10 14:01 [linux-lvm] Copying LVM from one system to another Shaun Mccullagh
2006-07-10 17:18 ` Ming Zhang
2006-07-11 17:48   ` Dieter Stüken
2006-07-11 18:03     ` Shaun Mccullagh
2006-07-11 19:12       ` Dieter Stüken
2006-07-11 19:50         ` Shaun Mccullagh
2006-07-11 18:10     ` Ming Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).