0

I have tried to backup a drive using rsync and it doesn't seem to work as intended. The plan is to backup the drive to a secondary drive and only replace the missing files. However, what it does is instead of replacing the backup it just makes a new directory within the virtual drive and backups up to that.

How can I make it backup properly by only backing up what it needs to replace? Like modified files and new files. Perhaps I should try a different backup program.

The command line I'm using is as so:

sudo rsync -aAXv --delete /media/veracrypt1/HD /media/veracryrypt2/HD

For now I've simply done a manual backup by copying the main virtual drive and pasting it in another external hard drive.

My system info: running Linux Debian, kernel release: 4.9.0-6-amd64

2
  • Append a trailing slash (/) to your source path
    – roaima
    May 30 '18 at 21:56
  • @Arthur please do not modify commands in the question unless it's been confirmed that typos were introduced in the question and were not present when originally executed.
    – muru
    May 31 '18 at 7:02
2

rsync is behaving correctly. If you don't want it to re-create the top-level directory inside the destination, you should append a trailing slash (/) to the source on the command line.

From man rsync(1):

A trailing slash on the source changes this behavior to avoid creating an additional directory level at the destination. You can think of a trailing / on a source as meaning "copy the contents of this directory" as opposed to "copy the directory by name", but in both cases the attributes of the containing directory are transferred to the containing directory on the destination.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.