Mounting tape drive to LXC

J1810Z

Member
Dec 30, 2019
6
0
21
36
Hi,

I am trying to passthrough a tape drive to an privileged container. My configuration looks as follows:

Code:
arch: amd64
features: nesting=1
hostname: bacula-storage
memory: 2048
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=86:AB:E3:80:F4:57,ip=dhcp,ip6=dhcp,type=veth
onboot: 1
ostype: ubuntu
rootfs: local-lvm:vm-101-disk-1,size=8G
swap: 512
lxc.apparmor.profile: unconfined
lxc.cgroup2.devices.allow: c 21:1 rwm
lxc.cgroup2.devices.allow: c 9:* rwm
lxc.mount.entry: /dev/nst0 dev/nst0 none bind,optional,create=file
lxc.mount.entry: /dev/st0 dev/st0 none bind,optional,create=file
lxc.mount.entry: /dev/sg0 dev/sg0 none bind,optional,create=file

Code:
root@backup:~# ls -l /dev/nst0
crw-rw---- 1 root tape 9, 128 Mar 25 20:38 /dev/nst0

root@backup:~# ls -l /dev/st0
crw-rw---- 1 root tape 9, 0 Mar 25 20:38 /dev/st0

root@backup:~# ls -l /dev/sg0
crw-rw---- 1 root tape 21, 0 Mar 25 20:38 /dev/sg0

root@backup:~# lsscsi -g
[0:0:0:0]    disk    ATA      SSD_2.5"_256GB_I 4A0   /dev/sda   /dev/sg1
[2:0:0:0]    tape    HP       Ultrium 5-SCSI   Z64D  /dev/st0   /dev/sg0


Unfortunately, the tape drive seems to be only partly accessible. I can write to new tapes, but I cannot locate the end of write position on pre-written tapes.
The output of tapeinfo also looks strage:

Code:
root@bacula-storage:~# tapeinfo -f  /dev/nst0
mtx: Request Sense: Long Report=yes
mtx: Request Sense: Valid Residual=no
mtx: Request Sense: Error Code=0 (Unknown?!)
mtx: Request Sense: Sense Key=No Sense
mtx: Request Sense: FileMark=no
mtx: Request Sense: EOM=no
mtx: Request Sense: ILI=no
mtx: Request Sense: Additional Sense Code = 00
mtx: Request Sense: Additional Sense Qualifier = 00
mtx: Request Sense: BPV=no
mtx: Request Sense: Error in CDB=no
mtx: Request Sense: SKSV=no
INQUIRY Command Failed

tapeinfo on the host works fine.

Any ideas how to solve this? Thanks!