Skip to content

moviuro/butter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Butter

butter (until someone finds a better name) is/will be a bash utility to manage btrfs subvolumes.

Quickstart

Needed folders

# butter_dir=/mnt/butter/"$(if [ -r /etc/machine-id ]; then cat /etc/machine-id; else uname -r; fi)"
# mkdir -p "$butter_dir"
# for fs in $(lsblk -fl|awk '{ if ($2 ~ "btrfs") print $3 }'); do
    mkdir -p "$butter_dir/$fs"
    mount -osubvol=/ /dev/disk/by-uuid/"$fs" "$butter_dir/$fs"
    mkdir -p "$butter_dir/$fs/__butter"
  done

Take snapshots

# butter snapshot /
# butter snaplist
MOUNTPOINT  TYPE     DATE                          UUID
/           default  Sun Dec 20 16:52:44 CET 2015  082df386-98c2-44d9-9012-07fb2b22ea20

Take automated snapshots

# butter add /,/home,/var hourly

And then you can add to your cron or w/e:

butter snapshot ALL type hourly

Questions?

  • Why bash? It is only targeted for Linux, so bash it is.

  • Why butter? Because ButterFS, I guess.

Installation

You can run a "portable" version pretty easily:

git clone [email protected]:moviuro/butter.git
cd butter
./butter help

If you run Archlinux, there is a PKGBUILD available on the AUR. TL;DR:

  • cp butter /usr/bin/
  • mkdir -p /usr/lib/butter/ && cp lib-btr/* /usr/lib/butter/
  • butter.8 goes to wherever manpages go
  • LICENSE goes to wherever licenses go

Bugs

If you can't patch the bugs you find, please open an issue on github or gitlab describing the issue and append the output of butter -d that triggers the bug you found.