GithubHelp home page GithubHelp logo

mk01 / btrfs-auto-snapshot Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 2.0 152 KB

btrfs-auto-snapshot targets to provide functionality like zfs-auto-snapshot.

License: GNU General Public License v2.0

Shell 100.00%

btrfs-auto-snapshot's Introduction

btrfs-auto-snapshot

btrfs-auto-snapshot targets to provide all the functionality found in http://mk01.github.io/zfs-auto-snapshot. It is build on it's basis. Because Btrfs thinks of snapshot & volumes in a slightly different ways (snapshots / volumes and it's organization within Btrfs filesystem), one to one perception and style of work (learned from ZFS) isn't directly possible.

There btrfs-auto-snapshot scripts comes into play while having the functioniality of auto backup agent, it provides some kind of layer between btrfs and the user. It tries to clone the known commands of 'zfs' (related to snapshots manipulation - list snapshots, volumes, snapshot command, destroy, clone, rename, promote, rollback).

Currently functional in testing is:

working

1) listing volumes and snapshots
2) creating ad hoc snapshots (will not be touched by rotations) 
3) regular (planned snapshots)
4) destroy
5) snapshots rotation (rr, hanoi tower still to go)
6) rename

missing

7) promote
8) rollback
9) clone

Alltogether with the scripting itself some organization of btrfs subvolumes is needed. Btrfs is one big tree of namespaces and calling it subvolumes. A subvolume (B) created under namespace of (A) will not be visible after we create snapshot (C) of (A), because (C) is lets say 'detached-copy' of (A), which is not containing (B). (B) is only a subtree attached to a (A).

One can think of this like 'mount' would be working. If we mount a dev2 under directory of mounted dev1, if we create a copy of dev1, mount dir will be empty and dev1 will not have data from dev2.

Working solutions is create empty btrfs filesystem (id=0), then create subvolumes (/, /home, /var...) and it's snapshots. On top, copy data. Let's imagine this first snapshot as live (running) copy of the data - data we are working on.

btrfs-fs(id=0) -- ROOT / @running 
                        
                
                \ HOME / @running
                
                
                \ VAR / @running 

New snapshot are created from @running, within the one btrfs subvolume tree which for us is making representation of analogue of ZFS filesystem.

btrfs-fs(id=0) -- ROOT / @running / [x]
                       / @snap1
                
                \ HOME / @running
                       / @snap2
                
                \ VAR  / @running 
                       / @snap_wrong_copy

Once we have such a structure, we can look onto the subvolumes (with name starting with '@') like onto snapshots and manipulate freely as with ZFS snapshots & filesystems.

Volumes must be mounted with mount option subvol=path_to/snapshot/@running (in this example).

btrfs-auto-snapshot's People

Contributors

mk01 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.