borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
10.94k stars 739 forks source link

Restore backup over ssh? #4670

Closed lukeeexd closed 5 years ago

lukeeexd commented 5 years ago

Hey, cant for the life of me find anything on this.

So I recently(today) started playing with borg. Got it working to backup over ssh to another server. How would I go about restoring said backups back to the server it originated from?

ThomasWaldmann commented 5 years ago

You either run borg mount or borg extract on the same host as where you ran borg create.

mount is more comfortable if you don't exactly know where the files are which you are searching and if you only need a low volume of files. it does not support some metadata like e.g. ACLs.

extract is better for full or high-volume restores as it is faster. also, it cares for a lot of metadata like ACLs, xattrs, etc.

lukeeexd commented 5 years ago

So its literally the same as borg create with the same options after it? so like

borg extract --progress --stats luke@DESTINATION_IP:/home/luke/borg::test-backup /Path/to/put/backup/on/destination/machine ?

ThomasWaldmann commented 5 years ago

You can see the archived paths when using borg list on the archive.

You'll notice that borg removed all leading slashes.

borg extract does not support giving a destination directory, but always extracts to the current directory.

If you give a path to borg extract, it is a matching expression (if you do not want to extract all), not a destination directory.

ThomasWaldmann commented 5 years ago

BTW, the docs are linked from https://borgbackup.org/ - you can check all the details there.

ThomasWaldmann commented 5 years ago

BTW, for desktop users who prefer a GUI and want to save their home directory, there is also vorta:

https://github.com/borgbase/vorta/

lukeeexd commented 5 years ago

Ah, so i need to extract to a directory then my best bet would be rsync back across?

ThomasWaldmann commented 5 years ago

The restore destination should be an empty directory. borg does not support transforming a non-empty dir to the state as present in your backup archive.

What you do afterwards (rename it into place or rsync) is your choice.

ThomasWaldmann commented 5 years ago

Maybe we should have a section about recovery with the essentials (similar to the quick install section with the backup script).

lukeeexd commented 5 years ago

Yeah, all good got it all figured out. Thanks for the help and quick replies

jirib commented 5 years ago

I also feel little bit annoyed about the need to create subdir for borg in $HOME because init wants empty dir. Maybe it could ignore hidden files like .ssh dir?

ThomasWaldmann commented 5 years ago

borg init does not want an empty dir, it usually creates the repo directory by itself.

But if you give an empty directory, it accepts the given directory (not a non-empty one though).

jirib commented 5 years ago

borg init does not want an empty dir, it usually creates the repo directory by itself.

But if you give an empty directory, it accepts the given directory (not a non-empty one though).

Exactly, let's say BORG_REPO=ssh://${clientname}@example.com which would be ${clientname}'s home dir and probably having .ssh subdir. Yes, I can manage SSH keys in different way (LDAP, AuthorizedKeysCommand...).

ThomasWaldmann commented 5 years ago

It's a bad idea to put a borg repo directly into a home dir without using a subdir.

Just use $HOME/borg_repo or a even better name, that is much cleaner and just works.

ThomasWaldmann commented 5 years ago

@lukeeexd please review #4723 - is that clear enough? Something important missing?

lukeeexd commented 5 years ago

@lukeeexd please review #4723 - is that clear enough? Something important missing?

Uhh yeah sure haha, not really sure what I'm looking at

ThomasWaldmann commented 5 years ago

Not sure what you mean. The link to #4723 is a pull request (a proposed change for borg).

The top comment there has also a link to normally displayed docs.