-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbsnapshot
More file actions
executable file
·53 lines (32 loc) · 1.09 KB
/
bsnapshot
File metadata and controls
executable file
·53 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
# This script will rsync various directories to ZFS and snapshot them.
# (c) 2007 Chris Samuel
# This script is licensed under the GPL v3 license or later.
# http://www.gnu.org/copyleft/gpl.html
# First work out the datestamp to be used for all snapshots.
DATE=$(date +%Y%m%d-%H%M)
# Configuration
# Volume name
VOLNAME=/media/DR
# Subvolume name
SUBVOL=${VOLNAME}/current
# Snapshot name
SNAPNAME=${VOLNAME}/${DATE}
echo Snapshot will be labelled $DATE
if [ \! -d $SUBVOL ]; then
echo "DR volume not mounted!"
exit 1
fi
# Snapshot top level directories we care about.
for i in etc home; do
echo Processing $i
time rsync --inplace --no-whole-file --delete-excluded --exclude .beagle --exclude .bibble --exclude .googleearth --exclude .thumbnails -a /$i/ ${SUBVOL}/$i/
done
# Snapshot directories under /srv
for i in Subversion Archives backup; do
echo Processing $i
time rsync --inplace --delete-excluded --exclude .beagle --exclude .bibble --exclude .googleearth --exclude .thumbnails -a /srv/$i/ ${SUBVOL}/$i/
done
btrfs subvolume snapshot $SUBVOL $SNAPNAME
sync
# All done!