[Borgbackup] Lock error

Steve Schow steve at bstage.com
Mon May 16 17:39:22 EDT 2016


Actually I will improve it a bit more…I will use this same trap mechanism to make sure that I don’t accidentally get a long running backup running so long that the next cron doesn’t stomp on it…  The wrapper bash script would be like this, which should make sure that as long as nobody is trying to call borg create directly but only using this wrapper, then it will not run twice at once….and will clean up any lock if something gets orphaned that way.




lock=/tmp/$REPO.lock
if [ -d $lock ]
then
	echo “borg is currently running on $REPO, exiting…
	exit 1
fi

function finish {
	borg break-lock $REPO
	rm -rf $lock
	
}

trap finish EXIT
trap finish INT
trap finish QUIT
trap finish TERM

mkdir -p $lock

borg create bla bla bla $REPO






On May 15, 2016, at 8:23 PM, Steve Schow <steve at bstage.com> wrote:

> So here is one idea I have for automatically cleaning up the lock files.  I would appreciate any feedback..  The only thing is that it sees like I had to go to the remote machine and break the lock there and it didn’t work over SSH.
> 
> using bash shell script:
> 
> function finish {
>    borg break-lock $REPO
> }
> trap finish  EXIT
> trap finish  INT
> trap finish  QUIT
> trap finish  TERM
> 
> borg create bla bla bla
> 
> 
> 
> 
> 
> On May 15, 2016, at 1:32 PM, Steve Schow <steve at bstage.com> wrote:
> 
>> So I ran into this problem also today while running my first very large backup.  The size of my backup is close to 2TB.  it got most of the way through and then froze for some reason.  I hit ctrl-C and tried to launch it again and got these errors about locks.  Because I was using a remote repository, I found that I had to issue the break-lock command on both computers before I could run my backup again.
>> 
>> I hope this design will get a revisit sometime in the future.
>> 
>> In the meantime, what can I do to automate the handling of this problem?  I want my backup on a cron job.  Anyone have any suggestions for how to automatically clean up the lock problem when it occurs?  Particularly since it has to be cleaned up no both machines?
>> 
>> 
>> 
>> On May 14, 2016, at 4:36 PM, Adrian Klaver <adrian.klaver at aklaver.com> wrote:
>> 
>>> On 05/14/2016 03:24 PM, Sergio Belkin wrote:
>>>> Hi,
>>>> 
>>>> When I try to resume an interrupted "borg create" it outputs this error:
>>>> 
>>>> Failed to create/acquire the lock
>>>> /mnt/backup/sergio_backup/lock.exclusive (timeout).
>>>> 
>>>> Why?
>>> 
>>> http://borgbackup.readthedocs.io/en/stable/internals.html#lock-files
>>> 
>> 
>> _______________________________________________
>> Borgbackup mailing list
>> Borgbackup at python.org
>> https://mail.python.org/mailman/listinfo/borgbackup
> 
> _______________________________________________
> Borgbackup mailing list
> Borgbackup at python.org
> https://mail.python.org/mailman/listinfo/borgbackup



More information about the Borgbackup mailing list