FreeBSD Bugzilla – Attachment 187998 Details for
Bug 86388
[geom] [geom_part] periodic(8) daily should backup gpart(8) partition labels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Backup of zpool info, zfs list and zfs properties
223.backup-zfs.sh (text/plain), 1.98 KB, created by
Miroslav Lachman
on 2017-11-14 17:19:28 UTC
(
hide
)
Description:
Backup of zpool info, zfs list and zfs properties
Filename:
MIME Type:
Creator:
Miroslav Lachman
Created:
2017-11-14 17:19:28 UTC
Size:
1.98 KB
patch
obsolete
>#!/bin/sh > >## $Id: 223.backup-zfs.sh 58697be4119d 2017-10-03 03:09 +0200 lachman $ >## Created by: Miroslav Lachman <000.fbsd@quip.cz> > >## Backup of zpool info, zfs list and zfs properties for each filesystem. >## Data are stored on local filesystem, in /var/backup. >## It is recommended to copy those files to off-site storage. > > >## If there is a global system configuration file, suck it in. >## >if [ -r /etc/defaults/periodic.conf ] >then > . /etc/defaults/periodic.conf > source_periodic_confs >fi > >bak_dir=/var/backups > >rotate() { > base_name=$1 > show_diff=$2 > file="$bak_dir/$base_name" > > if [ -f "${file}.bak" ] ; then > rc=0 > if cmp -s "${file}.bak" "${file}.tmp"; then > rm "${file}.tmp" > else > rc=1 > [ -n "$show_diff" ] && diff "${file}.bak" "${file}.tmp" > mv "${file}.bak" "${file}.bak2" || rc=3 > mv "${file}.tmp" "${file}.bak" || rc=3 > fi > else > rc=1 > mv "${file}.tmp" "${file}.bak" || rc=3 > [ -n "$show_diff" ] && cat "${file}.bak" > fi >} > >case "$daily_backup_zfs_verbose" in > [Yy][Ee][Ss]) show="YES" >esac > >case "$daily_backup_zfs_enable" in > [Yy][Ee][Ss]) > > zpools=$(zpool list -vp | sed -E 's/^([ ]*[\./[:alnum:]]+ +[\.[:alnum:]-]+) .*/\1/') > > if [ -z "$zpools" ]; then > echo '$daily_backup_zfs_enable is set but no zpools found.' > rc=2 > else > echo "" > echo "Backup of ZFS informations for all imported pools"; > > echo "$zpools" > "$bak_dir/zpool_info.tmp" > rotate "zpool_info" $show > > zfs list -p -H -o name,mountpoint > "$bak_dir/zfs_list.tmp" > rotate "zfs_list" $show > > : ${daily_backup_zfs_props_enable="YES"} > case "$daily_backup_zfs_props_enable" in > [Yy][Ee][Ss]) > zfs get -H -p -t filesystem,volume all | > grep -E -v "available|compressratio|logicalreferenced|logicalused|refcompressratio|referenced|used|usedbychildren|usedbydataset|written" > "$bak_dir/zfs_props.tmp" > rotate "zfs_props" > > zpool get -H -p all | > grep -E -v "capacity|dedupratio|free|allocated|fragmentation" > "$bak_dir/zpool_props.tmp" > rotate "zpool_props" > ;; > esac > fi > ;; > *) rc=0;; >esac > >exit $rc
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 86388
:
57233
|
187996
|
187997
| 187998