Say I am running an HTTP server with data at /var/www
. I want to backup /var/www
to /root/backup/.tmp/var/www
(and then tar them to somewhere) daily automatically.
Mostly the backup is using rsync
technique. The problem is that since the HTTP server is running, there could be file modification during an rsync backup process.
For an HTTP server a certain "transaction" could involve multiple files, e.g. modifying file A and B at once, and therefore such scenario is possible: rsync backups file A => a transaction occurs and file A and B are modified => rsync backups file B. This causes the backup-ed files to be inconsistent (A is before transaction while B is after transaction).
For an HTTP server shutting down for backup is mostly not viable. Is there a way to avoid such inconsistent file backup?
This also applies to potentially other services like FTP (a certain "transaction" could be an upload of a folder which contains multiple files) or so.