CentOS moving to new HW.

Issues related to hardware problems
Post Reply
Free1p
Posts: 14
Joined: 2020/10/09 10:08:54

CentOS moving to new HW.

Post by Free1p » 2022/01/22 15:19:42

we are switching to new HW .
This is possible ?
old hardware - with live production software installed (tag diskA)
new hardware - installed clean same OS (tag as diskB)

tar -cvf diskA.tar / #(root file system)
Shutdown old hardware (diskA)

then in diskB
tar -xvf diskA.tar /

Will software will work in new hardware ?

or maybe DD without MBR ?

What other possibilities ?

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS moving to new HW.

Post by TrevorH » 2022/01/22 16:28:51

Not how you are suggesting, no. For a start your tar command will attempt to tar everything including /proc /sys /dev plus all other filesystems that are mounted under /. You do not want that.

Personally I would clone the entire disk, MBR and all, with dd to a new drive attached to the old system. Clone from a CD boot so that nothing is in use at the time. Insert the new disk in the new machine and then boot from that using the rescue kernel, probably amending the kernel command line to tell it to come up in single user or emergency mode. Once booted like that, rebuild the initramfs file for the latest kernel that is installed on the machine using dracut -f --kver=3.10.0-1160.49.1.el7.x86_64 or whatever the latest kernel is that you have installed (look in /lib/modules for the directory names, those are what you can use). Now the copy of the old disk ought to boot relatively cleanly on the new machine but you still have a bunch of stuff to track down and change before you can go live. All the network connections will most likely be based on the MAC addresses of the ethernet cards that are installed in the old machine so those will all need changing, either in /etc/sysconfig/network-scripts/ifcfg-* or using overly complicated network manager commands. There are probably other machine specific things that you also need to change.

And really, the best way to do this in the future is to set up all your configuration changes that you make to a machine in a configuration management system like puppet/chef/ansible/etc. Then you can do a clean install from scratch, install the configuration manager and tell it to make the machine look like it ought to and that's it. That also means you have a way to recreate this machine if a disaster happens.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Free1p
Posts: 14
Joined: 2020/10/09 10:08:54

Re: CentOS moving to new HW.

Post by Free1p » 2022/01/23 06:32:59

But 'dd' will also copied
/proc /sys /dev plus all other filesystems that are mounted under /
+
I can use
tar --exclude= ..

I couldn't find any manual procedure for that so I guess its more complicated then just extract tar into the new disk..

Thanks.

Whoever
Posts: 1357
Joined: 2013/09/06 03:12:10

Re: CentOS moving to new HW.

Post by Whoever » 2022/01/23 07:12:41

Free1p wrote:
2022/01/23 06:32:59
But 'dd' will also copied
/proc /sys /dev plus all other filesystems that are mounted under /


It won't copy those filesystems because they don't exist on disk. They are pseudo filesystems. Using "dd" on the whole drive means that they won't be copied.

Free1p
Posts: 14
Joined: 2020/10/09 10:08:54

Re: CentOS moving to new HW.

Post by Free1p » 2022/01/23 10:09:40

Thank you for the clarification

Post Reply