mkbak_media: Add file and block number to lib csv

master
Markus Koch 2022-03-24 12:14:37 +01:00
parent 29115ff44e
commit 3f212ca6bc
1 changed files with 5 additions and 3 deletions

View File

@ -37,11 +37,11 @@ fi
info "Backing up new directories to $MEDIA_ID in $DEV."
if [ ! -f "$LIB" ]; then
echo "Directory;Media ID;Date" > $LIB
echo "Directory;Media ID;File;Block;Date" > $LIB
fi
info "Configuring tape drive"
# mt-st -f $DEV stsetoptions scsi2logical
mt-st -f $DEV stsetoptions scsi2logical
mt-st -f $DEV compression 0
if [ "$MODE" == "append" ]; then
@ -78,13 +78,15 @@ for dir in *; do
continue;
fi
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
if [ $? -ne 0 ]; then
err "An error occured writing the backup to tape. Aborting."
exit
fi
date=`date`
echo "$dir;$MEDIA_ID;$date" >> $LIB
echo "$dir;$MEDIA_ID;$fileno;$block;$date" >> $LIB
done
info "Rewinding and ejecting tape"