You can find the remaining tape capacity in the SCSI logs, along with many other interesting tidbits such as compression ratio, read/write failures, drive/tape history, etc.
sg_logs -a /dev/nst1
This utility is available in distro packages commonly named sg3-utils
or sg3_utils
.
You're looking for lines such as:
Main partition remaining capacity (in MiB)
Megabytes written to tape
(subtract from uncompressed capacity)
Data bytes written to media by WRITE commands
(subtract from uncompressed capacity)
Failing that, you can try vendor-specific tools. For example HP has HPE Library & Tape Tools, which works on all HP-compatible* drives. Buried in its menus you can find the ability to create and view a report of a drive which offers all the info found in sg_logs
and more.
And failing all that, you can just write incompressible data until the end of tape and do the maths on the blocks written to figure what was remaining (goes without saying this is a bit nasty):
dd if=/dev/urandom of=/dev/nst1 bs=1M status=progress iflag=fullblock
or
openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero | dd of=/dev/nst1 bs=1M status=progress iflag=fullblock
I've used nst1
throughout this answer as that is the device in the original question, update as necessary.