All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jakob Schürz" <wertstoffe@nurfuerspam.de>
To: Marc MERLIN <marc@merlins.org>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Skript for backup btrfs on external HD
Date: Sun, 30 Nov 2014 11:56:14 +0100	[thread overview]
Message-ID: <547AF7CE.2060103@nurfuerspam.de> (raw)
In-Reply-To: <20141129221807.GA8916@merlins.org>

Am 2014-11-29 um 23:18 schrieb Marc MERLIN:
> On Sat, Nov 29, 2014 at 10:51:08PM +0100, Jakob Schürz wrote:
>> Am 2014-11-29 um 22:11 schrieb Marc MERLIN:
>>> On Sat, Nov 29, 2014 at 09:34:01PM +0100, Jakob Schürz wrote:
>>>> Hi there!
>>>>
>>>> I made a script to do backup with btrfs on a external HD.
>>>> You can see the function, how it works, and how it's to be used on
>>>> my site http://linux.xundeenergie.at/doku.php?id=mkbtrbackup
>>>> The site is in german. An english one will follow later.
>>>>
>>>> Do you want some explanations?
>>>
>>> Sure, how is it different from those 3?
>>> https://btrfs.wiki.kernel.org/index.php/Incremental_Backup#Available_Backup_Tools
>>
>> Wheter i haven't seen it, or this scripts can't do recursive backup...
>
> That's probably right, at least not automatically.

And that's why i made the script. :)

>
>> If you have subvolumes in subvolumes (for example: /home,
>> /home/user1, /home/user2 /var, /var/spool, /var/lib are extra
>> subvolumes IN the normal filetree from linux), my script takes them
>> all.
>
> For me, they are all subvolumes also mounted on /mnt/btrfs_poolx
> so I backup from there.

That's also possible with my skript, because you can control it with an 
config-file.
For example you have
/
|-@
|-@home
`-@var

And you want all your snapshots of this 3 subvolumes in separate 
directories with timestamp (and maybe .hourly_X-Tag)
put in the config:

SNPMNT=/path/to/btrfs-poolmount
BKPMNT=/path/to/external/HD/mountpoint

backup	@	roots	backup/roots
backup	@home	homes	backup/homes
backup	@var	vars	backup/vars

start the skript with
mkbtrbackup create --interval hourly -c /path/to/backupconfig

you get in /path/to/btrfs-poolmount 3 directories (roots, homes and 
vars), and on /path/to/external/HD/mountpoint one directoriy "backup", 
including also the three given subdirectories from the 4th coloumn 
(leave this coloumn blank, no auto-transfer to the external HD!!!)

in this subdirectories you get subvolumes like
@.20141130-115001.hourly_0
@home.20141130-115001.hourly_0
@var.20141130-115001.hourly_0

AND they are rotated automatically.

>
>> And my script changes the fstab-entry in the new snapshot.
>> The original has the option "subvol=@SUBVOL", where @SUBVOL is the
>> name of the original system.
>
> I don't need to do that, my script updates a symlink pointing to the
> last snapshot, and you can use subvol=symlink-name

I'm trying on this, it's not finished. There are many discussions about. 
What is better... modify grub.cfg on each snapshot, work with symlinks...

I create one symlink @*.CURRENT. I will rename it to .LAST... so i can 
do the same with a static grub-entry

>
>> You get a systemd-unit, in the tarball, which makes a snapshot from
>> your system, on successful boot, so you can switch back fast, if an
>> update destroyed your system.
>>
>> And it is for minimal-systems... no python, no perl, no java... only
>> shell(bash) :-)
>
> That makes sense, thanks for explaining.

For example... on an raspberry Pi it would be a good thing. :)

Hope, you try it, and give me some feedback. ;-)

Jakob

      parent reply	other threads:[~2014-11-30 10:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29 20:34 Skript for backup btrfs on external HD Jakob Schürz
2014-11-29 21:11 ` Marc MERLIN
2014-11-30 10:42   ` Jakob Schürz
     [not found]   ` <547A3FCC.1050806@nurfuerspam.de>
     [not found]     ` <20141129221807.GA8916@merlins.org>
2014-11-30 10:56       ` Jakob Schürz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=547AF7CE.2060103@nurfuerspam.de \
    --to=wertstoffe@nurfuerspam.de \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=marc@merlins.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.