[backup] Add btrfs_snapshot_date.sh

Makes a dated snapshot with Btrfs.
This commit is contained in:
Matteo Cypriani 2011-08-17 00:04:15 +02:00
parent 4f9bb9d7fd
commit bca8250c5a
2 changed files with 37 additions and 0 deletions

View File

@ -8,6 +8,21 @@ The transfer will be reattempted until it succeed.
Edit the script to configure the protocol, host, directories, etc.
# btrfs_snapshot_date.sh #
This script is a wrapper to btrfs subvolume snapshot, that creates a
snapshot of a subvolume, the snapshot's name being the subvolume name
with the current date and time appended to it.
It is supposed that the subvolume to snapshot resides in a directory
which needs to be mounted before to make the snapshot (for example if
you defined your default subvolume to your system's root, and mount the
volume 0 on /media/pool).
Edit the script to configure the directories (and to understand what is
being done).
# backup_sites_mysql.sh #
The script backup_sites_mysql.sh is designed to save websites data files

22
backup/btrfs_snapshot_date.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
#
# btrfs_snapshot_date.sh, Copyright © 2011 Matteo Cypriani <mcy@lm7.fr>
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#
# Makes a snapshot of a Btrfs subvolume with the date appended to its
# name.
# Mount point of the Btrfs root volume (in which the subvolumes
# reside):
ROOT=/media/pool
# Name of the subvolume to snapshot:
SV="backupsv"
mount "$ROOT"
SV="$ROOT/$SV"
btrfs subvolume snapshot "$SV" "$SV"_$(date '+%Y-%m-%dT%H:%M:%S')