I'm not sure if the heading is really coorect. I have a line in my rsnapshot.conf
backup [email protected]:/mnt/rsnapshot/ srv01/
So rsnapshot creates a directors RSNAPSHOT_ROOT/daily.0/srv01/mnt/rsnapshot
and puts the backed-up files there. For me, the /mnt/rsnapshot
part is unnecessary; I'd rather have my backed-up files directly in RSNAPSHOT_ROOT/daily.0/srv01/
. Is there any way to achieve this?
rsnapshot
uses the--relative
flag ofrsync
to preserve pathname information. In most cases, you probably do want to keep (at least some of) that information, especially when backing up local directories. However, in your case, you really don't need to keep the leading path prefix.With reasonably recent versions of
rsync
(v.2.6.7+), you can explicitly control the portion of the pathname prefix that--relative
saves by inserting a./
at the desired cut-point. The./
does not effectively change the pathname, but it does tellrsync
that you want--relative
to only keep the part of the pathname that follows the./
. Since you want to cut off the entire pathname, you simply append the./
onto the end of the source path, like this:EDIT
Okay, so it looks like the
./
trick won't work in this case, sincersnapshot
strips off the trailing/
. Instead, you should be able to disable the--relative
option on a per-backup-point basis, by adding a fourth column to yourbackup
line, like this:The
+rsync_long_args
tellsrsnapshot
to append to its existingrsync_long_args
option, for the current backup-point only. By appending--no-relative
torsync_long_args
, you achieve the desired effect of turning off--relative
.Steven's first suggestion to use
./
does actually work with rsnapshot, you just have to put it twice:Rsnapshot will strip the last slash of, but the first dot works for rsync.
This behaviour is actually controlled by rsync's
--relative
flag. Quoting the rsync manual:So, in your
rsnapshot.conf
find the line that starts withrsync_long_args
. By default,--delete --numeric-ids --relative --delete-excluded
should be present. Removing the--relative
option, should lead to the desired results.