linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Skript for backup btrfs on external HD
@ 2014-11-29 20:34 Jakob Schürz
  2014-11-29 21:11 ` Marc MERLIN
  0 siblings, 1 reply; 4+ messages in thread
From: Jakob Schürz @ 2014-11-29 20:34 UTC (permalink / raw)
  To: linux-btrfs

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?

greetings
jakob
-- 
http://xundeenergie.at
http://verkehrsloesungen.wordpress.com/
http://cogitationum.wordpress.com/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Skript for backup btrfs on external HD
  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>
  0 siblings, 2 replies; 4+ messages in thread
From: Marc MERLIN @ 2014-11-29 21:11 UTC (permalink / raw)
  To: Jakob Schürz; +Cc: linux-btrfs

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

Thanks,
Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Skript for backup btrfs on external HD
  2014-11-29 21:11 ` Marc MERLIN
@ 2014-11-30 10:42   ` Jakob Schürz
       [not found]   ` <547A3FCC.1050806@nurfuerspam.de>
  1 sibling, 0 replies; 4+ messages in thread
From: Jakob Schürz @ 2014-11-30 10:42 UTC (permalink / raw)
  To: linux-btrfs

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...

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.
It looks on the external storage, if there's an older snapshot (i call 
all subvolumes together in this case a snapshot!!) which is also on the 
local machine. If so, is makes a incremental backup. If not, a initial 
transfer is started. For each subvolume in the snapshot!

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.
It changes the @SUBVOLUME to the subvolume-id, so you can mount your 
snapshot easy.

One Point is missing... Modifying of grub to serve boot-menu-entries for 
older snapshots.

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) :-)

regards
jakob


-- 
http://xundeenergie.at
http://verkehrsloesungen.wordpress.com/
http://cogitationum.wordpress.com/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Skript for backup btrfs on external HD
       [not found]     ` <20141129221807.GA8916@merlins.org>
@ 2014-11-30 10:56       ` Jakob Schürz
  0 siblings, 0 replies; 4+ messages in thread
From: Jakob Schürz @ 2014-11-30 10:56 UTC (permalink / raw)
  To: Marc MERLIN; +Cc: linux-btrfs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-30 12:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).