/root/Script/zfs_snapshot.sh
#!/bin/bash
POOL_LIST="pluto0"
#FS_LIST="home apps photos repository plexlibrary tmp tmp_portage"
FS_LIST=
DAILY_SS="home plexlibrary"
WEEKLY_SS="apps photos repository"
MONTHLY_SS="tmp tmp_portage"
function date_str() { echo $(date +%Y.%m.%d-%H:%M:%S); }
function snapshot()
{
for temp in $FS_LIST;
do
zfs snapshot $POOL_LIST/$temp@$(date_str)
#echo $POOL_LIST/$temp@$(date_str)
done
}
#
#
#
function main()
{
#PN=$(echo $0 | sed 's/.\///')
PN=$(basename $0)
echo $PN
if [ $PN = "daily_snapshot.sh" ]; then
FS_LIST=$DAILY_SS
elif [ $PN = "weekly_snapshot.sh" ]; then
FS_LIST="$DAILY_SS $WEEKLY_SS"
elif [ $PN = "monthly_snapshot.sh" ]; then
FS_LIST="$DAILY_SS $WEEKLY_SS $MONTHLY_SS"
fi
snapshot
}
#
#
#
main
chmod 755 zfs_snapshot.sh
ln -s /root/Script/zfs_snapshot.sh /etc/cron.daily/daily_snapshot.sh
ln -s /root/Script/zfs_snapshot.sh /etc/cron.daily/weekly_snapshot.sh
ln -s /root/Script/zfs_snapshot.sh /etc/cron.daily/monthly_snapshot.sh
* 스냅샷 확인 명령
# zfs list -t snapshot
'운영_설치 > 리눅스_유닉스' 카테고리의 다른 글
zfs로 사용중이던 디스크를 새로운 시스템에 연결하기 (0) | 2019.01.31 |
---|---|
리눅스에서 망헐 egg/alz 압축 해제 (0) | 2018.06.18 |
젠투 zfs 사용하기 #1 (0) | 2018.06.01 |
젠투 커널 설정 (0) | 2018.05.31 |
젠투 amd64 설치 2018.05.31 (0) | 2018.05.31 |