2

Here are my commands

mt -f /dev/st0 rewind
dd if=/dev/st0 of=-

As I understand it the first command rewinds my tape in /dev/st0, and the second command writes contents of /dev/st0 to -. My questions are

  • Where is -?
  • What is this command doing when it writes the data from the tape to -?

The result of the command is:

dd: writing to '-': No space left on device
1234567+0 records in
1234566+0 records out
140000000000 bytes (141 GB) copied, 14500.9 s, 9.8 MB/s

It appears to me I have written the data to something, but I would like to verify where that data was written.

Is it just reading the tape?

Thanks for the help

roaima
  • 107,089
  • 14
  • 139
  • 261

1 Answers1

2

It's been a long time since I've used tape. However, here's what I believe is happening

mt -f /dev/st0 rewind

This rewinds the tape in /dev/st0 ready for writing. Once the device is closed the tape is then automatically rewound because you didn't use the non-rewind device probably called something like /dev/nst0. Obviously in this instance the second part of this operation is effectively a no-op.

dd if=/dev/st0 of=-

This reads as many blocks of 512 bytes from the tape device /dev/st0 as possible, and writes them to a file called - in your current directory. (Specifically, - is not an alternative name for stdout.) For a tape this can cause a lot of overruns and rewinds as it tries to handle partial reads from the typically larger block size (often 4K or 8K, but can be much larger). At the end of the dd operation the device is closed and the tape will be rewound automatically.

Depending on the block size you may want something like this (I've called the output file tape.dat rather than -)

dd bs=4K if=/dev/st0 > tape.dat
roaima
  • 107,089
  • 14
  • 139
  • 261
  • roaima, thanks for the reply. This was meant to be a test of the functionality of the tape drive and the server to make sure they were installed correctly. I believe we can call the install good based on the output. I see no file called `-` on the server. Is it possible it wrote to `-` but since `-` doesn't exist nothing was written, or would it create `-` and then write to it? As noted before, find / -name "-" returns nothing. – JustAn0therL0stTechnician Oct 03 '20 at 14:56
  • You got an error, `dd: writing to '-': No space left on device` so the file was created and it filled the disk. Is it possible someone else removed it? – roaima Oct 03 '20 at 15:04
  • It is possible but highly unlikely someone removed it. I guess my mission now is to locate `-` to delete it. – JustAn0therL0stTechnician Oct 03 '20 at 15:13
  • `less ./-` returns no such file or directory. As noted before, `find / -name "-"` returns nothing. `find -name '-' -exec less {} +` returns nothing. Is there anything else to try? – JustAn0therL0stTechnician Oct 03 '20 at 15:34
  • Have any of your disks run out of space (`df -h`)? If not, the file has been deleted – roaima Oct 03 '20 at 15:38
  • Could be tmpfs if you have 141GB of RAM/Swap ;-) could also be autocleaned if it was in a tmp dir that is cleaned by your system regularly – frostschutz Oct 03 '20 at 16:47