zfs-auto-snapshot
已安装并已应用以下设置:
# zfs get all backup
NAME PROPERTY VALUE SOURCE
backup com.sun:auto-snapshot true local
backup com.sun:auto-snapshot:monthly true local
backup com.sun:auto-snapshot:weekly true local
backup com.sun:auto-snapshot:hourly true local
backup com.sun:auto-snapshot:frequent true local
backup com.sun:auto-snapshot:daily true local
安装已经半周了,检查快照时,只存在四个最常见的快照:
# zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
backup@zfs-auto-snap_frequent-2017-06-17-0645 3.06M - 123G -
backup@zfs-auto-snap_frequent-2017-06-17-0700 1.57M - 123G -
backup@zfs-auto-snap_frequent-2017-06-17-0715 1.43M - 123G -
backup@zfs-auto-snap_frequent-2017-06-17-0730 928K - 123G -
答案1
您应该阅读文档或源代码。
打开/sbin/zfs-auto-snapshot
并设置系统默认选项。
# Set default program options.
opt_backup_full=''
opt_backup_incremental=''
opt_default_exclude='1'
opt_dry_run=''
opt_event='-'
opt_fast_zfs_list='1'
opt_keep=''
opt_label=''
opt_prefix='snap'
opt_recursive=''
opt_sep='_'
opt_setauto=''
opt_syslog=''
opt_skip_scrub=''
opt_verbose=''
opt_pre_snapshot=''
opt_post_snapshot=''
opt_do_snapshots='1'
cron脚本/etc/cron.d/zfs-auto-snapshot
使用适当的参数运行命令:
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
*/5 * * * * root /sbin/zfs-auto-snapshot -q -g --label=frequent --keep=24 //
00 * * * * root /sbin/zfs-auto-snapshot -q -g --label=hourly --keep=24 //
59 23 * * * root /sbin/zfs-auto-snapshot -q -g --label=daily --keep=14 //
59 23 * * 0 root /sbin/zfs-auto-snapshot -q -g --label=weekly --keep=4 //
00 00 1 * * root /sbin/zfs-auto-snapshot -q -g --label=monthly --keep=4 //