Jukebox-access (tape drive) from OpenVZ

udo

Distinguished Member
Apr 22, 2009
5,975
196
163
Ahrensburg; Germany
Hi,
has anybody connect from an OpenVZ-VM a tape drive?

I tried following:
on the proxmox host
Code:
dmesg | grep " 0:0:0:"
st 0:0:0:0: Attached scsi tape st0
ch 0:0:0:1: Attached scsi changer ch0
st 0:0:0:0: Attached scsi generic sg0 type 1
ch 0:0:0:1: Attached scsi generic sg1 type 8

ls -lsa /dev/sg*
0 crw-rw---- 1 root tape  21, 0 20. Aug 09:27 /dev/sg0
0 crw-rw---- 1 root tape  21, 1 20. Aug 09:27 /dev/sg1
0 crw-rw---- 1 root cdrom 21, 2 19. Aug 19:04 /dev/sg2
0 crw-rw---- 1 root root  21, 3 19. Aug 19:04 /dev/sg3
0 crw-rw---- 1 root root  21, 4 19. Aug 19:04 /dev/sg4
0 crw-rw---- 1 root root  21, 5 19. Aug 19:04 /dev/sg5

mknod --mode 660 /var/lib/vz/private/101/dev/sg0 c 21 0
mknod --mode 660 /var/lib/vz/private/101/dev/sg1 c 21 1

ls -lsa /var/lib/vz/private/101/dev/sg*
0 crw-rw---- 1 root root 21, 0 20. Aug 12:01 /var/lib/vz/private/101/dev/sg0
0 crw-rw---- 1 root root 21, 1 20. Aug 12:01 /var/lib/vz/private/101/dev/sg1

chgrp tape /var/lib/vz/private/101/dev/sg*

ls -lsa /dev/*st0*
0 crw-rw---- 1 root tape 9, 128 20. Aug 09:27 /dev/nst0
0 crw-rw---- 1 root tape 9, 224 20. Aug 09:27 /dev/nst0a
0 crw-rw---- 1 root tape 9, 160 20. Aug 09:27 /dev/nst0l
0 crw-rw---- 1 root tape 9, 192 20. Aug 09:27 /dev/nst0m
0 crw-rw---- 1 root tape 9,   0 20. Aug 09:27 /dev/st0
0 crw-rw---- 1 root tape 9,  96 20. Aug 09:27 /dev/st0a
0 crw-rw---- 1 root tape 9,  32 20. Aug 09:27 /dev/st0l
0 crw-rw---- 1 root tape 9,  64 20. Aug 09:27 /dev/st0m

mknod --mode 660 /var/lib/vz/private/101/dev/nst0 c 9 128
mknod --mode 660 /var/lib/vz/private/101/dev/nst0a c 9 224
mknod --mode 660 /var/lib/vz/private/101/dev/nst0l c 9 160
mknod --mode 660 /var/lib/vz/private/101/dev/nst0m c 9 192
mknod --mode 660 /var/lib/vz/private/101/dev/st0 c 9 0
mknod --mode 660 /var/lib/vz/private/101/dev/st0a c 9 96
mknod --mode 660 /var/lib/vz/private/101/dev/st0l c 9 32
mknod --mode 660 /var/lib/vz/private/101/dev/st0m c 9 64

chgrp tape /var/lib/vz/private/101/dev/nst0*
chgrp tape /var/lib/vz/private/101/dev/st0*

mt -f /dev/nst0 status
drive type = 114
drive status = 1174405120
sense key error = 0
residue count = 0
file number = 0
block number = 0

vzctl start 101
The same mt command fail inside the VM:
Code:
mt -f /dev/st0 status
mt: /dev/st0: rmtopen failed: Permission denied
The VM is a debian-6-standard.

Any help are welcome! If it's impossible i run the bacula storage-daemon directly on the host...

Udo
 
You already allowed access to that device with vzctl?

see "Device access management" in 'man vzctl'

maybe something like:

# vzctl set 777 --devnodes st0:rw
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!