DevHeads.net

Create CentOS 6 system as "clone" of another - with LVM and different disk sizes

Hi,

I just found myself having to set up a new CentOS 6 system with a nearly
identical configuration to an existing host, so I thought I would just

1. Do a minimal install to set up partitions etc. on the new system.
2. Create an image of the existing system using Clonezilla
(<a href="http://www.clonezilla.org" title="http://www.clonezilla.org">http://www.clonezilla.org</a>)
3. Run a Clonezilla restore on the new system.

- as I though it would be a lot simpler than replicating the exact
package selection, installing the same users, doing the same manual
config edits (which are required) etc.

It turns out that it wasn't quite as easy, though. The problem is that
the system use LVM2 volumes for the filesystems, and the new host has a
slightly smaller disk than the other, and Clonezilla seems unable to
restore to a volume that's smaller than the one that was cloned - even
if the actual data fits.

I guess I could temporarily reduce the LVM volume sizes on the existing
units and clone again, but I'd rather not if I can avoid it. Just
copying file-by-file could be an option, too, but I somehow feel less
comfortable doing that than the above; there is something about the way
I could end up with a mixture of my "minimal install" and the "cloned"
data, I suppose.

Does anyone have any other ideas about how I might achieve what I want?

- Toralf

Comments

Re: [Marketing Mail] Create CentOS 6 system as "clone"

By Lange, Markus at 04/13/2018 - 09:32

Hi,

You can simply boot a live system to create your partition layout and copy it
over the existing system with rsync. Once your system is copied, you will need
to customize all hardware-dependent configuration files such as {crypt,fs}tab,
network configurations, bootloader and so on depending on your setup.

Don't forget to install the bootloader afterwards!

You can also install a minimal system and use a live system to copy the files
from the existing server to the new one (e.g. with rsync -a). This way you do
not have to create the partition layout and bootloader manually.

Using clonezilla would only replace the part of copying the files and installing
the bootloader, all other settings still have to be made. Rsync should be much
faster for data transfer.

Best regards,
 - Markus
On Fr, 2018-04-13 at 14:46 +0200, Toralf Lund wrote: