Copying A Live System

Home » CentOS » Copying A Live System
CentOS 5 Comments

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.

5 thoughts on - Copying A Live System

  • Timothy Murphy wrote:

    Yes. When we’re cloning a system, such as a compute node in a cluster, or rsync upgrading, we rsync -HPavxz /. newmachine:/new/. rsync -HPavxz /boot/. newmachine:/boot//new/.

    As long as you’re not copying /sys or /proc….

    mark

  • Am 03.05.2016 um 15:55 schrieb Timothy Murphy :

    It depends, the running services should answer … for a mysqld running system:

    Delete the -x option above and add

    –exclude /proc –exclude /sys –exclude /mnt –exclude /var/lib/mysql

    and then

    mysqldump –add-drop-table -c –create-options -x -u root -p -A > mysqldump-$(date +%s).sql

    for example …

  • Timothy Murphy wrote:

    Oh, I hit 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-

    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