Does anybody here have any idea how to make an exact copy of a drive that has LVM partitions? I'm having trouble using dd to do this for an EL5 server. We're trying to diagnose a software problem of some kind and would like an exact, perfect copy of the software running so that we can see exactly what the problem is without disturbing our production copy. It's been admin practice to set up a single server with the ideal image as desired, and then use DD to replicate that image to multiple hosts. We've done this a large number of times. The exact procedure followed is: -) Perform typical file-level backups with rsync -) Install additional HDD (hereafter sdb) as least a big as the HDD to be duplicated. -) Boot off a CentOS install DVD with "linux rescue" -) Where /dev/sda is the original drive and /dev/sdb is the new drive, run: dd bs=8192 if=/dev/sda of=/dev/sdb; -) shutdown the server upon completion of the previous command and remove 2nd drive. Hereafter, using systems NOT running lvm, we have a bootable drive that can be installed into a 2nd machine and generally expect things to "just work" after sorting out a few driver issues. (EG: /dev/eth#s change) Following this exact procedure with partitions on LVM does NOT result in a booting system! -) When booting from the newly imaged drive, it starts the boot just fine but quits at: ---------------------------- Activating logical volumes Volume group "VolGroup00" not found Trying to resume from /dev/VolGroup00/LogVol01 Unable to access resume device (/dev/VolGroup00/LogVol01) Creating root device. Mounting root filesystem. mount: could not find filesystem '/dev/root' --SNIP-- switchroot: mount failed: no such file or directory Kernel panic - not syncing: Attempted to kill init! ---------------------------- -) Running Linux rescue, at the shell: ---------------------------- # pvscan PV /dev/sda2 VG VolGroup00 lvm2 [153.28 GiB / 0 free] Total: 1 [153.28 GiB] / inuse: 1 [153.28 GiB] / in no VG: [0 ] # vgscan Reading all physical volums. This may take a while... Found volume group "VolGroup00" using metadata type lvm2 # lvscan inactive '/dev/VolGroup00/LogVol00' [151.31 GiB] inherit inactive '/dev/VolGroup00/LogVol01' [1.97 GiB] inherit ---------------------------- -) Running the EL5 installer with the "Find distro" option on mounts the install at /tmp/sysimage without issue. What am I missing?!?!
Mondo? http://www.mondorescue.org -- Mike Burger http://www.bubbanfriends.org "It's always suicide-mission this, save-the-planet that. No one ever just stops by to say 'hi' anymore." --Colonel Jack O'Neill, SG1> Does anybody here have any idea how to make an exact copy of a drive > that has LVM partitions? I'm having trouble using dd to do this for an > EL5 server. > > We're trying to diagnose a software problem of some kind and would like > an exact, perfect copy of the software running so that we can see > exactly what the problem is without disturbing our production copy. It's > been admin practice to set up a single server with the ideal image as > desired, and then use DD to replicate that image to multiple hosts. > We've done this a large number of times. The exact procedure followed is: > > -) Perform typical file-level backups with rsync > -) Install additional HDD (hereafter sdb) as least a big as the HDD to > be duplicated. > -) Boot off a CentOS install DVD with "linux rescue" > -) Where /dev/sda is the original drive and /dev/sdb is the new drive, > run: > dd bs=8192 if=/dev/sda of=/dev/sdb; > -) shutdown the server upon completion of the previous command and > remove 2nd drive. > > Hereafter, using systems NOT running lvm, we have a bootable drive that > can be installed into a 2nd machine and generally expect things to "just > work" after sorting out a few driver issues. (EG: /dev/eth#s change) > Following this exact procedure with partitions on LVM does NOT result in > a booting system! > > -) When booting from the newly imaged drive, it starts the boot just > fine but quits at: > ---------------------------- > Activating logical volumes > Volume group "VolGroup00" not found > Trying to resume from /dev/VolGroup00/LogVol01 > Unable to access resume device (/dev/VolGroup00/LogVol01) > Creating root device. > Mounting root filesystem. > mount: could not find filesystem '/dev/root' > --SNIP-- > switchroot: mount failed: no such file or directory > Kernel panic - not syncing: Attempted to kill init! > ---------------------------- > > > -) Running Linux rescue, at the shell: > ---------------------------- > # pvscan > PV /dev/sda2 VG VolGroup00 lvm2 [153.28 GiB / 0 free] > Total: 1 [153.28 GiB] / inuse: 1 [153.28 GiB] / in no VG: [0 ] > # vgscan > Reading all physical volums. This may take a while... > Found volume group "VolGroup00" using metadata type lvm2 > # lvscan > inactive '/dev/VolGroup00/LogVol00' [151.31 GiB] inherit > inactive '/dev/VolGroup00/LogVol01' [1.97 GiB] inherit > ---------------------------- > > -) Running the EL5 installer with the "Find distro" option on mounts the > install at /tmp/sysimage without issue. > > What am I missing?!?! > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >
Antonio da Silva Martins Junior
2013-Mar-19 12:22 UTC
[CentOS] Making a clone of an LVM-based EL5 install
----- "Lists" <lists at benjamindsmith.com> escreveu:> De: "Lists" <lists at benjamindsmith.com> > Para: "CentOS mailing list" <centos at centos.org> > Enviadas: Segunda-feira, 18 de Mar?o de 2013 19:36:41 (GMT-0300) Auto-Detected > Assunto: [CentOS] Making a clone of an LVM-based EL5 install > > Does anybody here have any idea how to make an exact copy of a drive > that has LVM partitions? I'm having trouble using dd to do this for an >Hi, What about Clonezilla (www.clonezilla.org) or Mondo (www.mondorescue.org) ?? But, I do it with dd too, and it works fine with LVM. Att., Antonio. -- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Antonio S. Martins Jr. - Support Analyst | "Only The Shadow Knows | | Universidade Estadual de Maring? - Brasil| what evil lurks in the | | NPD - N?cleo de Processamento de Dados | Heart of Men!" | | E-Mail: asmartins at uem.br / shadow at uem.br | !!! Linux User: 52392 !!! | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ "Real Programmers don?t need comments ? the code is obvious." -- Esta mensagem foi verificada pelo sistema de antivirus e acredita-se estar livre de perigo.
On 03/18/2013 03:36 PM, Lists wrote:> -) When booting from the newly imaged drive, it starts the boot just > fine but quits at: > ---------------------------- > Activating logical volumes > Volume group "VolGroup00" not foundThe only reason that I can think of that would cause this is an initrd that doesn't contain the driver for the whatever adapter the disk is attached to. Boot the rescue image and identify the adapter module. When you've identified it, go back to the live system and make a new initrd using "--with <adapter_module>". Don't replace the existing initrd, just create a new one in /boot. If you then clone the disk, you should be able to boot the cloned disk to grub. Edit the kernel definition and change the path to the initrd, selecting the one you've created for the new system. It should boot properly, at which point you can replace the standard initrd path or fix grub's configuration file. ...and if you don't want to clone the system again, you can just boot the rescue environment, chroot to the sysimage, and make the initrd there.