I'm trying to dump our online backups to tape; for obvious reasons I want to encrypt the data on the tapes, so to write to the tape I need to tar everything up, pipe that to openssl to encrypt it, then write that to tape:
tar c /etc | openssl aes-128-cbc -salt -pass "pass:Test123" | dd of=/dev/nst0
However it appears the dd doesn't like this. Writing directly to the tape from tar works fine:
svr-bup1 # tar cf /dev/nst0 /etc tar: Removing leading `/' from member names svr-bup1 #
Adding dd into the chain and it breaks:
svr-bup1 # tar c /etc | dd of=/dev/nst0 tar: /dev/nst0: Cannot open: Device or resource busy tar: Error is not recoverable: exiting now 0+0 records in 0+0 records out 0 bytes (0 B) copied, 9.6274e-05 s, 0.0 kB/s
The same happens with and without the openssl command; I omitted it above to simplify the testing.
mt commands work fine (with env variable TAPE set):
svr-bup1 # mt status SCSI 2 tape drive: File number=6, block number=0, partition=0. Tape block size 0 bytes. Density code 0x46 (LTO-4). Soft error count since last status=0 General status bits on (81010000): EOF ONLINE IM_REP_EN svr-bup1 # mt rewi svr-bup1 #
Hardware is a HP 1720 LTO4 SAS drive using the mpt2sas driver on CentOS 6.