[CentOS] Copying a live system

m.roth at 5-cent.us
2016-05-03T14:36:39Z

Timothy Murphy wrote:
> I want to backup my current CentOS-7.2 system to another drive.
> Is it safe to copy the system while it is running?
> Eg by
> mount /dev/sdb5 /mnt
> rsync -HPaxvz /. /mnt/
> I've found contradictory advice on the web.

Oh, I hit <send> before I added several more things:

First, correct the MAC address in
/etc/udev/rules.d/70-persistant-net.rules (or it might be 60), and in
/etc/sysconfig/network-scripts for ifcfg-<whatever>

Second, you'll need a new /etc/ssh/sshd-host-*

If you're getting your name & IP (and IPv6) from DHCP, don't forget
to
update the DHPCD server.


Finally, this works if the system is identical hardware. If not, before
you try to boot, boot from linux rescue, then you need to
chroot /mnt/sysimage

cd /lib/modules

VER=$(ls -rt1 | tail -1)
echo $VER

mkinitrd X $VER
mv X /boot/initrd-$VER.img

At that point, you should be good to go.

       mark