Skip to content

Backup over SSH confuses 'ssh' and 'local' commands? #57

@joshbrooks

Description

@joshbrooks

Not sure how to summarize this except that it seems that there's some unintended behaviour when backing up over ssh where the src and dest parameters are mixed up.

This leads to the check for backup.marker running over the SSH connection on the source, and the latest link being created on the source.

Description

  • rsync-time-machine requires a backup marker on the source not dest when backing up over ssh
  • The destination directory is created on the SSH source
  • The 'latest' link is created on the SSH source

Details

I'm backing up a folder over ssh with the command

rsync-time-machine josh@edesk.local:/home/josh/Documents /tmp/edesk.local/Documents

So edesk.local is my source, and I'm backing up to to machine the script is running on. I expect this to mirror the content of my remote folder (@edesk.local) to /tmp/... on the computer I run the command on.

Here is what happens the first time

/tmp via 🐍 v3.11.3 (rdiffdb-py3.11) 
❯ rsync-time-machine josh@edesk.local:/home/josh/Documents /tmp/edesk.local/Documents
rsync-time-machine.py: Safety check failed - the destination does not appear to be a backup folder or drive (marker file not found).
rsync-time-machine.py: If it is indeed a backup folder, you may add the marker file by running the following command:
rsync-time-machine.py: ssh -p 22 josh@edesk.local 'mkdir -p -- "/tmp/edesk.local/Documents" ; touch "/tmp/edesk.local/Documents/backup.marker"'

As expected there is no backup marker, so it errors out.
However what's surprising here is that the command given is to add the backup marker, on the source (that is, edesk).

OK, we run that command suggested

❯ ssh -p 22 josh@edesk.local 'mkdir -p -- "/tmp/edesk.local/Documents" ; touch "/tmp/edesk.local/Documents/backup.marker"'

and now we run backup the command again with the following result.

❯ rsync-time-machine josh@edesk.local:/home/josh/Documents /tmp/edesk.local/Documents                                     
rsync-time-machine.py: No previous backup - creating new one.
rsync-time-machine.py: Creating destination ssh -p 22 josh@edesk.local/tmp/edesk.local/Documents/2024-03-25-162106
rsync-time-machine.py: Starting backup...
rsync-time-machine.py: From: josh@edesk.local:/home/josh/Documents/
rsync-time-machine.py: To:   /tmp/edesk.local/Documents/2024-03-25-162106/
rsync-time-machine.py: Running command:
rsync-time-machine.py: rsync -e 'ssh -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' -D --numeric-ids --links --hard-links --one-file-system --itemize-changes --times --recursive --perms --owner --group --stats --human-readable --compress --log-file '/home/josh/.rsync-time-backup/2024-03-25-162106.log'  -- 'josh@edesk.local:/home/josh/Documents/' '/tmp/edesk.local/Documents/2024-03-25-162106/'
rsync-time-machine.py: [ERROR] Rsync reported an error. Run this command for more details: grep -E 'rsync:|rsync error:' '/home/josh/.rsync-time-backup/2024-03-25-162106.log'

Now I have a backup directory created; but it's on edesk (the ssh source)!

I create the backup directory on destination

mkdir -p /tmp/edesk.local/Documents/

and now it completes without errors, I can run
rsync-time-machine josh@edesk.local:/home/josh/Documents /tmp/edesk.local/Documents and everything backs up.

However

  • There is no check for a backup.marker in this folder
  • The 'destination' folders are actually created on edesk
  • The latest folder is not created here but on edesk

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions