Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore backup over ssh? #4670

Closed
lukeeexd opened this issue Jul 2, 2019 · 16 comments
Closed

Restore backup over ssh? #4670

lukeeexd opened this issue Jul 2, 2019 · 16 comments
Assignees
Milestone

Comments

@lukeeexd
Copy link

lukeeexd commented Jul 2, 2019

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
Copy link
Member

ThomasWaldmann commented Jul 2, 2019

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.

@ThomasWaldmann ThomasWaldmann changed the title Restore backup over sshh? Restore backup over ssh? Jul 2, 2019
@lukeeexd
Copy link
Author

lukeeexd commented Jul 2, 2019

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
Copy link
Member

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
Copy link
Member

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

@ThomasWaldmann
Copy link
Member

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
Copy link
Author

lukeeexd commented Jul 2, 2019

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

@ThomasWaldmann
Copy link
Member

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
Copy link
Member

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

@lukeeexd
Copy link
Author

lukeeexd commented Jul 3, 2019

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

@ThomasWaldmann ThomasWaldmann added this to the 1.1.x milestone Jul 3, 2019
@jirib
Copy link

jirib commented Aug 8, 2019

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
Copy link
Member

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
Copy link

jirib commented Aug 9, 2019

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
Copy link
Member

ThomasWaldmann commented Aug 9, 2019

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 ThomasWaldmann self-assigned this Aug 11, 2019
ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Aug 11, 2019
@ThomasWaldmann
Copy link
Member

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

@lukeeexd
Copy link
Author

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

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

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Aug 15, 2019

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.

ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this issue Aug 22, 2019
ThomasWaldmann added a commit that referenced this issue Aug 22, 2019
elho pushed a commit to elho/borg that referenced this issue Mar 17, 2020
@ghost ghost mentioned this issue Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants