Recently I found myself migrating, again, my cloud hosting provider. I like to keep a complete backup of all files so that in case I miss something it’s not forever lost in the ether.
This command comes in handy to rsync everything from one host to a backup location, which I can then use to migrate to the new cloud provider. This command skips the docker device mapper along with the other non-FS files in /dev /proc and /sys. It also uses a specified port (–rsh=’ssh -p XXXXX’) in case of non-standard SSH ports. Worked for me!
rsync -av --numeric-ids --exclude='/dev' --exclude='/proc' --exclude='/sys' --exclude='/var/lib/docker/devicemapper/' --progress --inplace --rsh='ssh -p22221' / [email protected]:/backups/backupdirectory
Another set, for skipping a lot more stuff, and focusing on the www:
rsync -av --rsh='ssh -p 22444' --progress --inplace / --exclude='/bin' --exclude='/boot' --exclude='/dev' --exclude='/initrd.im*' --exclude='/lib/' --exclude='/lib64/' --exclude='/lost+found' --exclude='/media' --exclude='/mnt' --exclude='/proc' --exclude='/run' --exclude='/sbin' --exclude='/srv' --exclude='/sys' --exclude='/tmp' --exclude='/usr' --exclude='/var' --exclude='/vmlinu*' --include='/var/www' [email protected]:/mnt/user/backups/ovh/rsync
rsync -av --rsh='ssh -p 22222' --progress --inplace /var/www/ [email protected]:/mnt/user/backups/ovh/rsync/var/www