When I try to read a tar from tape with tar tvbf 2048 /dev/nst0
, it returns:
tar: /dev/nst0: Cannot read: Device or resource busy
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now
And lsof | grep st0
returns nothing.
All commands works with mt works. If I try with strace:
...
open("/dev/nst0", O_RDONLY) = 3
read(3, 0x7ff16eb8f000, 1048576) = -1 EBUSY (Device or resource busy)
...
The tape drive has the latest firmware. The tape drive is an IBM ULTRIUM-HH6 and the firmware is F9A1.
Best Answer
mt -f /dev/nst0 status
work?dd
withtar
or just using tar as you wrote? There is a quirk when using tar piping and $TAPE environment variable. see below.Sometimes you issue a command, it fails, there is no noise from the drive, but the tape is not in "rewound" state anymore. Try implicit rewind before each command.
Do a test with another tape (run the commands immediately after each other: cd /path/to files mt -f /dev/nst0 rewind; tar -b 2048 -c -f /dev/nst0 * mt -f /dev/nst0 rewind; tar -b 2048 -t -f /dev/nst0
Btw if you don't want to pass -f /dev/nst0 all the time add
export TAPE=/dev/nst0
in your .bashrc. Keep in mind that if you have this variable tar will prefer the tape drive over stdin/stdout. So this will return "Device or resource busy"... because both dd and tar are trying to open the tape drive. The correct way to pipe tar is by passing
-f -
:Also I'm not sure if this block size will work well. In this document you can read:
So try dropping the block size to 256KiB or even 128KiB (That's tar -b 512 or -b 256 respectively).