Toralf Lund
2018-Apr-13 12:46 UTC
[CentOS] 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 (http://www.clonezilla.org) 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
Lange, Markus
2018-Apr-13 13:32 UTC
[CentOS] [Marketing Mail] Create CentOS 6 system as "clone" of another - with LVM and different disk sizes
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:> 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 > ????(http://www.clonezilla.org) > ?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 > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos
Toralf Lund
2018-Apr-13 13:45 UTC
[CentOS] [External] Re: [Marketing Mail] Create CentOS 6 system as "clone" of another - with LVM and different disk sizes
On 13/04/18 15:32, Lange, Markus wrote:> 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.Actually, I don't believe that's quite true. I've "cloned" to dissimilar hardware in the same manner before, and found that there was special handling of various hardware dependent config files, so that I didn't get set-up? for the "wrong" type. - Toralf> Rsync should be much > faster for data transfer. > > Best regards, > ?- Markus > On Fr, 2018-04-13 at 14:46 +0200, Toralf Lund wrote: >> 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 >> ????(https://urldefense.proofpoint.com/v2/url?u=http-3A__www.clonezilla.org&d=DwIGaQ&c=KV_I7O14pmwRcmAVyJ1eg4Jwb8Y2JAxuL5YgMGHpjcQ&r=Q0oqxzgUp3xCCIiJDwS-RbNDndQ-KZDhj8wwveNoqU4&m=LuCuhEh29vlP9l-Vakjf6lKeZVlmfp_AaqPakYDOV1c&s=7DzBbYmBU7fUsxgvVL-59HG_y2uuwR1jxcbXX5skfGM&e= ) >> ?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 >> >> _______________________________________________ >> CentOS mailing list >> CentOS at centos.org >> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.centos.org_mailman_listinfo_centos&d=DwIGaQ&c=KV_I7O14pmwRcmAVyJ1eg4Jwb8Y2JAxuL5YgMGHpjcQ&r=Q0oqxzgUp3xCCIiJDwS-RbNDndQ-KZDhj8wwveNoqU4&m=LuCuhEh29vlP9l-Vakjf6lKeZVlmfp_AaqPakYDOV1c&s=qjiIy57nu_S3OjTO1LYJjQmDFY6GkzLkKvn2F5IrUqo&e> _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.centos.org_mailman_listinfo_centos&d=DwIGaQ&c=KV_I7O14pmwRcmAVyJ1eg4Jwb8Y2JAxuL5YgMGHpjcQ&r=Q0oqxzgUp3xCCIiJDwS-RbNDndQ-KZDhj8wwveNoqU4&m=LuCuhEh29vlP9l-Vakjf6lKeZVlmfp_AaqPakYDOV1c&s=qjiIy57nu_S3OjTO1LYJjQmDFY6GkzLkKvn2F5IrUqo&e=
m.roth at 5-cent.us
2018-Apr-13 14:38 UTC
[CentOS] Create CentOS 6 system as "clone" of another - with LVM and different disk sizes
Toralf Lund wrote:> 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 > (http://www.clonezilla.org) > 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?Manually clone it. On the new machine: mkdir /new mkdir /boot/new rsync -HPavzx --exclude=/old --exclude=/var/log/wtmp $machine:/. /new/. rsync -HPavzx $machine:/boot/. /boot/new/. where $machine is the system you're cloning from. You might want to exclude other logfiles. To prevent problems with the Ethernet interfaces: rsync -HPavzx /etc/sysconfig/network-scripts/ifcfg-eth* /new/etc/sysconfig/network-scripts rsync -HPavzx /etc/sysconfig/hwconf /new/etc/sysconfig rsync -HPavzx /boot/grub/device.map /boot/new/grub/ rsync -HPavzx /etc/udev/rules.d/70-persistent-net.rules /new/etc/udev/rules.d/ Clean log files - you don't really want any of the old systems: find /new/var/log/ -type f -exec cp /dev/null {} \; Copy the original SSH keys - you do *not* want the keys of the system you're cloning from: rsync -HPavzx /etc/ssh/ssh_host* /new/etc/ssh Now rotate: zsh, because it lets you load it's builtin-s, so mv works zsh zmodload zsh/files cd /boot mkdir old mv * old mv old/lost+found . mv old/new/* . # Root partition. cd / mkdir old mv * old mv old/lost+found . #mv old/root . -- WHY? mv old/scratch . mv old/new/* . sync sync Also you might want to touch /.autorelabel to shut up selinux. Note that this assumes the same CPU, etc, Otherwise, you might need to make a new initrd. mark
Apparently Analagous Threads
- Create CentOS 6 system as "clone" of another - with LVM and different disk sizes
- [Marketing Mail] Re: [External] Re: [Marketing Mail] Create CentOS 6 system as "clone" of another - with LVM and different disk sizes
- Installing a single rpm package from desktop/browser on CentOS 7
- CentOS 7/GNOME 3 customise top panel
- CentOS 7/GNOME 3 customise top panel