#!/bin/bash
LD="/data/Decrypt/outputs/"
TIMESTAMP="$(date +%Y%m%d-%Hh%M)"
LF=LVM_backup_$TIMESTAMP.log
echo "start LVM backup on " `date` >$LD$LF
echo "========================================================" >>$LD$LF
sudo vgcfgbackup -v -f /etc/lvm/backup/mydell_$TIMESTAMP >>$LD$LF
echo "backup logical volumes done on /etc/lvm/backup/mydell_$TIMESTAMP" >>$LD$LF 
echo "scan logical volumes :" >>$LD$LF
sudo lvscan >>$LD$LF
echo "check recover logical volumes" >>$LD$LF
sudo vgcfgrestore mydell --test -v -f /etc/lvm/backup/mydell_$TIMESTAMP >>$LD$LF
echo " use command to restore this by command = vgcfrestore mydell -v -f /etc/lvm/backup/mydell_$TIMESTAMP " >>$LD$LF
echo "end LVM backup" >>$LD$LF
echo "========================================================" >>$LD$LF
cat $LD$LF
exit 0
