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.
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.
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
m.roth@5-cent.us 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.
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/.
Thanks very much to you, and all who responded to my query.
Anaconda live installs use this:
rsync -pogAXtlHrDx --exclude /dev/ --exclude /proc/ --exclude /sys/ --exclude /run/ --exclude /boot/*rescue* --exclude /etc/machine-id /run/install/source/ /mnt/sysimage
Chris Murphy
Am 03.05.2016 um 15:55 schrieb Timothy Murphy gayleard@eircom.net:
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.
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 ...
-- LF
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