[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Deleting old archives is slow
- To: Tom Limoncelli <tal@whatexit.org>
- Subject: Re: Deleting old archives is slow
- From: Garance AE Drosehn <gadcode@earthlink.net>
- Date: Tue, 29 Sep 2015 15:06:39 -0400
- Cc: Tarsnap Mailing List <tarsnap-users@tarsnap.com>
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=CsqzZG6dl4HMIVWlQ75sOJQyCFZVI11gBO8S5PD3YEKayTrgQ6ozgrUAi5TrsbDb; h=Received:Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer:X-ELNK-Trace:X-Originating-IP;
- In-reply-to: <CAHVFxgm1X7c6zrvnMonA+UZ=YW9JkwKvXAO_ENEFCpKDOug8Tg@mail.gmail.com>
- References: <CAHVFxg=w=QPZ0sSV0x93ySx6W5NqD3REn8yK1tLKYHEwqV3+ag@mail.gmail.com> <20150928141708.GA11945@soekris.calminferno.net> <CAHVFxgm1X7c6zrvnMonA+UZ=YW9JkwKvXAO_ENEFCpKDOug8Tg@mail.gmail.com>
On Sep 29, 2015, at 2:31 PM, Tom Limoncelli <tal@whatexit.org> wrote:
> On Mon, Sep 28, 2015 at 10:17 AM, James Turner <james@calminferno.net> wrote:
>> tarsnap -d -f archivename-2014010101 -f archivename-2014010102
>> -f archivename-2014010103
>
> It is good to know that this works. However it doesn't seem much
> faster. Also, I noticed that it fails the first time it hits a
> non-existent archive, so restarting after a failure requires a binary
> search or just reverting to doing them one at a time.
>
> tarsnap: Archive does not exist: archivename-2014010103
> tarsnap: Error deleting archive
I assume there isn't much you can do about how long it takes to delete
each archive. And you probably can't delete multiple archives at once
(in parallel), because they all have to work on the same database of
what data is still referenced by at least one of the remaining archives.
So I suspect the best you can do is stack up the delete requests so
you don't have to wait around for each one to finish before typing
in the next one. I spend so much time typing in command-lines that
I would just type in a 'for' loop:
for arcname in archivename-2014010101 archivename-2014010102 \
archivename-2014010103 ; do
echo "`date +%T` - Removing $arcname"
echo tarsnap -d -f $arcname
done
If I run that and it looks right, then I redo it without the 'echo' on
the tarsnap command. Note that you could combine the above idea with
a call to --list-archives:
for arcname in `tarsnap --list-archives | grep archivename-2014` ; do
echo "`date +%T` - Removing $arcname"
echo tarsnap -d -f $arcname
done
Again, first do it with the 'echo' to make sure that it will not be
deleting any archive you do care about. And then redo it without
the 'echo'.
And of course it's important that you would check before blindly doing
this, because the 'for' loop will blindly delete all the archives that
comes from the result of that `tarsnap --list-archives`.
--
Garance Alistair Drosehn = gadcode@earthlink.net
Senior Systems Programmer or gad@FreeBSD.org