[Borgbackup] question regarding restoration of latest backup

Wojtek Swiatek w at swtk.info
Mon Sep 17 03:05:13 EDT 2018


The "eureka" moment for me was when I realized that the best combo for my
backup scenario is backup + pruning. I backup often and then immediately
make sure afterwards that I only keep what is needed.
For what it's worth, I use a systemd timer to manage that:

[Unit]
Description=borg backup

[Service]
Type=oneshot
Environment=BORG_REPO=/services/backup/borg/
Environment=BORG_HOSTNAME_IS_UNIQUE=yes
ExecStart=/usr/bin/borg create --filter AME
--exclude-from=/services/backup/borg-exclude-srv.txt --list --stats
::srv-${INVOCATION_ID} /
ExecStartPost=/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=4
--keep-within 2d --stats

Cheers
Wojtek

Le dim. 16 sept. 2018 à 14:51, Christian <abelschreck3 at freenet.de> a écrit :

> Hi Wojtek,
>
> thanks for sharing your profile. It´s very impressive how you manage to
> handle those various possibilities borg offers.
> One has to dig really deep and get acquainted with all the options to make
> the best of it.
>
> As I still have another question, but on another topic, I think it´s best
> to post it as a separate item on the mailing list.
>
> Greetings
> Rosika
>
>
> Am 15.09.2018 um 19:06 schrieb Wojtek Swiatek:
>
> They follow a scheme of --keep-daily=7 --keep-weekly=4 --keep-within 2d
> (enforced by pruning them)
> The idea is that
> - the 4 weeklies are "just in case", I will never need them since I make
> many changes in my chaotic system but, in case I remember I want something
> in a span of a month it will be there
> - the dailies are to have 7 days of  backups, one per day
> - the "keep within 2 days" is to keep all backups I make within two days
> (they are started every 3 hours)
> As you can notice, I changed the naming scheme in the meantime and will
> need to wait ~two more weeks for the old one to be gone.
>
> In my risk profile, this allows to have a continuity of backups to recover
> from bad ideas for 2 days almost continuously (3 hours), then recover from
> possibly
> less bad ideas every day (for 7 days) and then from even less bad ideas a
> few times more, across a month.
> "Bad ideas" here mean some things I did and ended up not being the right
> ones to do.
>
> What is fantastic with borg is that this schedule actually does not matter
> for the backup. I could backup every 10 minutes and nothing would change
> (just more backups kept) - except that the machine would be backing up
> continuously.
> Disk wise it does not matter much in my case (the changes are small, if
> any)
>
> I could remove, say, srv-d2083d432b9243bf89d314bb2fc65c54 form today and I
> would have the data from srv-68384133c1ce45ad96c02e2a52906e8a
> and then srv-5042ecd186114756bd0f80f9b19817d5
>
> I find that backing up "often" is the solution, and then follow the backup
> with a prune to actually keep what is needed works best for me
>
> Cheers,
> Wojtek
>
>
>
> Le sam. 15 sept. 2018 à 18:39, Christian <abelschreck3 at freenet.de> a
> écrit :
>
>> Hi Marian,
>>
>> thanks again for your answer.
>>
>> Now I get it. That´s really fantastic.
>> I just tried it out by adding a new file to the original folder, then
>> backing it up and deleting the first backup.
>> And indeed the second backup holds all data including the newly created
>> one.
>>
>> borgbackup is really a wonderful programme. Now that I know how it works
>> I like it even better.
>>
>> Thanks again for your fast help.
>>
>> Have a nice weekend.
>>
>> Greetings.
>> Rosika
>>
>> Am 15.09.2018 um 17:57 schrieb Marian Beermann:
>> > Yes, that's indeed the case.
>> >
>> > Each archive can be independently manipulated from every other archive.
>> > Borg recognizes duplicate data (e.g. from Monday and Tuesday) backups
>> > and stores it only once; deleting Monday will not delete any data still
>> > used by Tuesday.
>> >
>> > -Marian
>> >
>> > On 9/15/18 5:48 PM, Christian wrote:
>> >> Hi Marian,
>> >>
>> >>
>> >> thank you so much for your fast answer.
>> >>
>> >> Yet it´s not quite clear to me how it works.
>> >>
>> >> Referring to my example: Do you say that I can delete the
>> Monday-backup?
>> >> That would imply that all the data of the Monday-backup is present in
>> >> the Tuesday-backup as well.
>> >>
>> >> I was of the opinion that the Tuesday-backup only holds the new data.
>> Or
>> >> did I get it wrong?
>> >>
>> >> Greetings
>> >> Rosika
>> >>
>> >>
>> >>
>> >> Am 15.09.2018 um 17:37 schrieb Marian Beermann:
>> >>> You don't have to think about any of that.
>> >>>
>> >>> You can create an archive.
>> >>> You can extract it.
>> >>> Deleting other archives makes no difference.
>> >>>
>> >>> -Marian
>> >>>
>> >>> PS: That's the trade-off made by Borg and similar software. Requires
>> >>> more CPU and memory resources, but gets rid of inter-backup
>> dependencies.
>> >>>
>> >>> On 9/15/18 5:27 PM, Christian wrote:
>> >>>> Hi altogether,
>> >>>>
>> >>>> I´ve got a question regarding restoration of backups.
>> >>>>
>> >>>> I looked at
>> https://borgbackup.readthedocs.io/en/stable/quickstart.html
>> >>>> for information. But somehow I couldn´t find what I was looking for.
>> >>>>
>> >>>> Out of sheer interest:
>> >>>>
>> >>>> Suppose I created a backup with "borg create /path/to/repo::Monday
>> ~/src
>> >>>> ~/Documents" .
>> >>>> And the next day: "borg create --stats /path/to/repo::Tuesday ~/src
>> >>>> ~/Documents" .
>> >>>>
>> >>>> It says: "This backup will be a lot quicker and a lot smaller since
>> only
>> >>>> new never before seen data is stored."
>> >>>>
>> >>>> O.K., I understand. But what if I wanted to restore the latest backup
>> >>>> (the "Tuesday" one)?
>> >>>> Since this one only holds the new data I suppose I´d have to keep the
>> >>>> "Monday" backup, too.
>> >>>>
>> >>>> But what would be the correct command? Would it be  "borg extract
>> >>>> /path/to/repo::Tuesday" ?
>> >>>> After all I want to retore the latest backup.
>> >>>> Would "borg extract /path/to/repo::Tuesday"  take care of the
>> "Monday"
>> >>>> backup automatically since the bulk of the data is stored there?
>> >>>>
>> >>>> Thanks a lot for your help.
>> >>>>
>> >>>> Greetings
>> >>>> Rosika
>> >>>>
>> >>>> _______________________________________________
>> >>>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/borgbackup/attachments/20180917/f97a875d/attachment.html>


More information about the Borgbackup mailing list