0

I tried to pipe tar to dd and use dd to write to tape in order to have progress:

export TAPE=/dev/nst0
tar -b 128 -c *| dd of=$TAPE bs=65536 status=progress

However I got an error

tar: /dev/nst0: Cannot open: Device or resource busy
tar: Error is not recoverable: exiting now

tar dd by themselves write just fine to the drive.

NickSoft
  • 248
  • 6
  • 22

1 Answers1

2

The key to this problem lies in the error message. It starts with 'tar'. Tar should be writing to stdout as it always does, not to the drive. dd does the writing to the drive. It turns out that if TAPE variable is set tar chooses to write to the tape drive instead to the pipe. So I fixed this by passing '-f -':

tar -b 128 -c -f - *| dd of=$TAPE bs=65536 status=progress
NickSoft
  • 248
  • 6
  • 22