项目作者: nachoparker

项目描述 :
Automatic BTRFS snapshots made simple
高级语言: Shell
项目地址: git://github.com/nachoparker/btrfs-snp.git
创建时间: 2017-12-27T09:50:34Z
项目社区:https://github.com/nachoparker/btrfs-snp

开源协议:GNU General Public License v3.0

下载


btrfs-snp

Create BTRFS snapshots, manually or from cron.

Usage

  1. # btrfs-snp
  2. Usage: btrfs-snp <dir> (<tag>) (<limit>) (<seconds>) (<destdir>)
  3. dir create snapshot of <dir>
  4. tag name the snapshot <tag>_<timestamp>
  5. limit keep <limit> snapshots with this tag. 0 to disable
  6. seconds don't create snapshots before <seconds> have passed from last with this tag. 0 to disable
  7. destdir │ store snapshot in <destdir>, path absolute or relative to <dir>

Examples

Manual

Snapshot of home

  1. # btrfs-snp /home

Tagged snapshot of root

  1. # btrfs-snp / preupgrade

Tagged snapshot of root, but keep maximum 10

  1. # btrfs-snp / preupgrade 10

Cron

Hourly snapshot for one day, daily for one week, weekly for one month, and monthly for one year.

  1. # cat > /etc/cron.hourly/btrfs-snp <<EOF
  2. #!/bin/bash
  3. /usr/local/sbin/$BIN /home hourly 24 3600
  4. /usr/local/sbin/$BIN /home daily 7 86400
  5. /usr/local/sbin/$BIN /home weekly 4 604800
  6. /usr/local/sbin/$BIN / weekly 4 604800
  7. /usr/local/sbin/$BIN /home monthly 12 2592000
  8. EOF
  9. chmod +x /etc/cron.hourly/btrfs-snp

Inspired by btrfs-snap by Birger Monsen

More at ownyourbits.com