Borg: How to gracefully kill borg on remote machine

Created on 1 Apr 2019  路  10Comments  路  Source: borgbackup/borg

Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

Is this a BUG / ISSUE report or a QUESTION?

Question

System information. For client/server mode post info for both machines.

Backing up from a client machine to a server over network

Your borg version (borg -V).

1.1.3 (I know I need to upgrade).

Operating system (distribution) and version.

CentOS 7.6

Hardware / network configuration, and filesystems used.

Local Network, GB Connection, CentOS 6.7, default LVM type filesystems

How much data is handled by borg?

500-600gb in this instance, about 6.7million files, doesn't seem to matter in this case.

Full borg commandline that lead to the problem (leave away excludes and passwords)

borg create --list someuser@hostname:reponame::e9gKdQDJ-tjU7ZKwvebfq2mLWNkOy /chroot/home
(note: private info redacted)

Describe the problem you're observing.

I don't know if this is necessarily a problem, or a feature. Let's say a backup is in progress. The client is backing up to the server and the client crashes or restarts. The server leaves the process open, for a period of time. (Eventually after a few hours, roughly, it seems to timeout). Would there be a safe way to kill this process and free the locks? Should anything be done to make sure the next backup is clean or can another backup just continue?

Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.

Yes, everytime.

Include any warning/errors/backtraces from the system logs

n/a

documentation

All 10 comments

you can maybe solve this on ssh level.
if the borg client dies, this means the ssh client is dying also.
if the ssh server checks the connection regularly, it should notice the client and the connection has died and terminate itself also, also terminating the server side "borg serve" process.

see #636 which mentions some of these ssh settings.

so if the server can see that the client is no longer running the borg process, is it safe to kill the process? then run borg break-locks on the repo? I have found that the server eventually terminates at some predefined period on it's own, but it seems to be quite a while (maybe an hour or more).

If there is no ongoing activity / no borg client connected, yes it should be safe to kill the process.

Preferably, send it a SIGTERM.

There is some code in borg that should clean up locks when it terminates, so you maybe do not even have to remove them afterwards.

See issue #3988.

The SSH client & server settings documented in my latest reply to that issue should prevent the borg serve process from sticking around after the client disconnects.

Somebody could check if we have docs or a faq entry about this and if not, do a PR to add some.

I'd love to do this, however this would be the first time I've created a pull request... :-)
I'll do some research into how to do this unless you've got time to give me some instructions.

Guess you can find the generic info on the web.

For borg, PRs usually are made against master branch and might be backported to 1.1-maint branch later.

Done, first ever pull request in. Be kind. :)

The documentation has been updated, I think this issue can now be closed?

Thank you. I think this will work for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

unlandm picture unlandm  路  4Comments

phdoerfler picture phdoerfler  路  6Comments

pierreozoux picture pierreozoux  路  4Comments

rugk picture rugk  路  5Comments

verygreen picture verygreen  路  4Comments