Protected storage servers allow free inbound bandwidth but limit the outbound bandwidth to the size of the hard drive. This is to encourage user of rsync and discourage the use of hosting for storage servers. Efficiently use bandwidth on your storage server by taking advantage of rsync.
Use rsync, don’t use archives for backups
Use rsync to backup and restore file changes. This reduces load and bandwidth on the storage servers and your production servers. Rsync will only copy file changes. You can also specify the ‘-z’ option to compress data during the transfer to reduce bandwidth.
Why rsync helps with restorations
Rather than using large archives and digging through them to restore files, you can easily restore specific files by rsyncing a specific directory. For example, Bob deletes important data on accident. Instead of digging through FullBackup.tar.gz, you can quickly run:
rsync -aHvz /backups/server1/home/Bob/. 220.127.116.11:/home/Bob/
This will automatically detect which files were changed or deleted and restore/transfer only those files. Bob has his data restored quickly and effectively.
The -u option in rsync
Rsync can use the -u option to skip the restore on newer files. For example, if you accidentally delete files in a directory and don’t want to overwrite changes you made to other files in the directory, use the -u option. This will restore all the deleted files but won’t change any files that are newly modified.
rsync -uaHvz /backups/server1/home/Bob/. 18.104.22.168:/home/Bob/
How to backup MySQL
You shouldn’t rsync or copy database files. Use mysqldump to create a dump file then copy it over to your server. Copying a database file on a running server can lead to table corruption.
mysqldump -uroot -p --all-databases > dump-`date +%Y-%m-%d`.sql