Compare commits
No commits in common. "3f212ca6bccc1063c1f0f87f78d118099ce352fb" and "578953beff7206f97c14ae10f268e02e6f23dd1f" have entirely different histories.
3f212ca6bc
...
578953beff
14
mkbak_media.sh
Executable file → Normal file
14
mkbak_media.sh
Executable file → Normal file
@ -37,20 +37,16 @@ fi
|
|||||||
info "Backing up new directories to $MEDIA_ID in $DEV."
|
info "Backing up new directories to $MEDIA_ID in $DEV."
|
||||||
|
|
||||||
if [ ! -f "$LIB" ]; then
|
if [ ! -f "$LIB" ]; then
|
||||||
echo "Directory;Media ID;File;Block;Date" > $LIB
|
echo "Directory;Media ID;Date" > $LIB
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Configuring tape drive"
|
info "Configuring tape drive"
|
||||||
mt-st -f $DEV stsetoptions scsi2logical
|
# mt-st -f $DEV stsetoptions scsi2logical
|
||||||
mt-st -f $DEV compression 0
|
mt-st -f $DEV compression 0
|
||||||
|
|
||||||
if [ "$MODE" == "append" ]; then
|
if [ "$MODE" == "append" ]; then
|
||||||
info "Append to end of data? [ctrl+c to cancel]"
|
info "Moving tape to end..."
|
||||||
read a
|
|
||||||
mt-st -f $DEV eod
|
mt-st -f $DEV eod
|
||||||
elif [ "$MODE" == "here" ]; then
|
|
||||||
info "Appending to tape at current position. This may overwrite existing data. Are you sure? [ctrl+c to cancel]"
|
|
||||||
read a
|
|
||||||
else
|
else
|
||||||
warn "Rewinding tape. This will delete all existing data on tape. Are you sure? [ctrl+c to cancel]"
|
warn "Rewinding tape. This will delete all existing data on tape. Are you sure? [ctrl+c to cancel]"
|
||||||
read a
|
read a
|
||||||
@ -78,15 +74,13 @@ for dir in *; do
|
|||||||
continue;
|
continue;
|
||||||
fi
|
fi
|
||||||
info "Appending $dir to tape ($lsize MB, $rsize MB available)"
|
info "Appending $dir to tape ($lsize MB, $rsize MB available)"
|
||||||
fileno=`mt-st -f $DEV status | sed -n 's/File number=\([0-9]\+\).*/\1/p'`
|
|
||||||
block=`mt-st -f $DEV tell | sed -n 's/.*At block \([0-9]\+\).*/\1/p'`
|
|
||||||
tar cvO "$dir" | dd of=$DEV bs=512k
|
tar cvO "$dir" | dd of=$DEV bs=512k
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "An error occured writing the backup to tape. Aborting."
|
err "An error occured writing the backup to tape. Aborting."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
date=`date`
|
date=`date`
|
||||||
echo "$dir;$MEDIA_ID;$fileno;$block;$date" >> $LIB
|
echo "$dir;$MEDIA_ID;$date" >> $LIB
|
||||||
done
|
done
|
||||||
|
|
||||||
info "Rewinding and ejecting tape"
|
info "Rewinding and ejecting tape"
|
||||||
|
Loading…
Reference in New Issue
Block a user