Linux backups can be performed perfectly with rsync. Read here how it works.
With “rsync” you can copy directory structures. The backup can then be compared with the original and if changes are made to the original, the backup is also updated.
If you create copies of the backup, you will have various versions.
rsync -av <quelle> <ziel>
creates a copy of <quelle> in <ziel>. After a 2nd call, only the changes are saved.
To create a 2nd version of the backup, you can create a hard link to the target directory:
cp -al <ziel> <backup_alt>
A hard link is a reference to a file. A file can therefore have several names, i.e. it can be addressed under several names. This means that no copy of the binary data is created, only another name is assigned. In our example, this has the advantage that only a “virtual” copy is made and the disc space is not further restricted. The file would only be deleted when the last link to the file is deleted. It is therefore also possible to delete old backup folders without losing data in new versions.
Calling our command again now compares the data in <ziel> with <quelle>. If there are any changes, these are also changed in <ziel> will also be changed. The hard links in <backup_alt> remain unaffected. The data occurrence that requires real disc space are the changes.
Now there are two more things to consider in the simple version:
rsync -av --delete --delete-excluded \ --exclude-from=/usr/local/etc/backup_exlude \ /home/imap/MailDir \ /data1/backup/home_imap_MailDIr
cp -al /data1/backup/home_imap_MailDIr \ /data1/backup/home_imap_MailDIr.datum
This creates an archive in “/data1/backup/home_imap_MailDir”, shows what rsync is currently doing, deletes files that are not present in the original if necessary. The path to the backup directory should already exist.
Then copy the backup with a hardlink to get an “old” version. Of course, this could also be done before the next backup, as the same version exists twice.