I am trying to work out how to stop DD from running when the records in = 0+x value, as DD just keeps going
Each TAR file seems to be no more than 15GB, so was thinking to somehow stop DD if output bytes above X value.
File10#262.tar is this example would be the last actual file, File10#265.tar is the file produced when records out is 0 + x records in:
0+122096647 records in 0+122096646 records out 50010782016 bytes (500GB) copied, 10975. 5 s, 45.6 MB/s
Relevant section
while dd if=/dev/nst0 of=/LTO/"FILE$i.tar" bs=256k status=progress conv=noerror,sync # loop till `dd` errors out
Complete script
#!/bin/bash
echo "Rewinding the tape one moment"
mt-st -f /dev/st0 rewind
i=01
while dd if=/dev/nst0 of=/LTO/"FILE$i.tar" bs=256k status=progress conv=noerror,sync # loop till `dd` errors out
do
i=10#$(printf "%02d" $((i+1))) # 0-padded 2-digit number;
done
echo "Tape extraction complete"
echo "Uncompressing files"
cd /LTO/
mv FILE01.tar FILE01.txt
for a in $(ls -1 *.tar); do tar -xvf $a --wildcards "*.mp4" "*.ssl" "*.enc" "*.mpg" "*.mpeg" --strip-components 3 --ignore-failed-read;
done
echo "Removing source compressed files"
find . -maxdepth 1 -name "*.tar" -type f -delete;
mt-st -f /dev/st0 rewind
mt-st -f /dev/st0 offline
echo "Tape process complete, please re-run sudo \bin\reptape.sh"
I have tried various switchs on the DD line "conv=noerror,sync" I am still learning so this might be a simple fix.
