CD/DVD Writer

From Proxmox VE
Jump to: navigation, search

Introduction

This procedure provides guest operating system access to the host's optical disk drive. It is an alterative to QEMU CD/DVD access, which Proxmox VE provides out of the box via the web graphical user interace.

Note: This procedure does not work as of June 2013 and Promox VE 3.x, because newer Proxmox kernels does not include the SCST driver. Addtitonally,the iscsitarget driver does not support tapes.

Using CD/DVD Writer as iSCSI target (for KVM guests)

Finally you can access the tape inside the VM with the standard iSCSI initiator (already included in Windows 2008). The Proxmox kernel already includes all needed iSCSI target modules. You just need to install 2 additional packages:

# apt-get install iscsi-scst scstadmin

First you need to get the "Device ID" of the DVD-writer in your host. Therefor use the following command:

# dmesg | grep DVD
ata5.01: ATAPI: HL-DT-ST DVDRAM GSA-4120B, A117, max UDMA/33
scsi 5:0:1:0: CD-ROM            HL-DT-ST DVDRAM GSA-4120B A117 PQ: 0 ANSI: 5

After that verify that the needed "Device handler" is available:

# cat /proc/scsi_tgt/scsi_tgt
Device (host:ch:id:lun or name)                             Device handler
0:0:0:0                                                     dev_disk
0:0:1:0                                                     dev_disk
0:1:0:0                                                     dev_disk
0:1:1:0                                                     dev_disk
0:1:2:0                                                     dev_disk
0:1:3:0                                                     dev_disk
5:0:1:0                                                     none

In my case it wasn't; so I needed to load the corresponding kernel-module:

# modprobe scst_cdrom
# cat /proc/scsi_tgt/scsi_tgt
Device (host:ch:id:lun or name)                             Device handler
0:0:0:0                                                     dev_disk
0:0:1:0                                                     dev_disk
0:1:0:0                                                     dev_disk
0:1:1:0                                                     dev_disk
0:1:2:0                                                     dev_disk
0:1:3:0                                                     dev_disk
5:0:1:0                                                     dev_cdrom

To enable this module on boot just add the line "scst_cdrom" to your '/etc/modules' file:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
scst_cdrom

Now you can add the "HANDLER cdrom"-section to the '/etc/scst.conf'-file and also edit the section "ASSIGNMENT Default":

[HANDLER cdrom]
#DEVICE <H:C:I:L>
DEVICE 5:0:1:0
[HANDLER disk]
#DEVICE <H:C:I:L>
[HANDLER vdisk]
#DEVICE <vdisk name>,<device path>,<options>,<block size>
[HANDLER tape]
#DEVICE <H:C:I:L>
[GROUP Default]
#USER <user wwn>
[ASSIGNMENT Default]
#DEVICE <device name>,<lun>
DEVICE 5:0:1:0,0
[TARGETS enable]
#HOST <wwn identifier>
[TARGETS disable]
#HOST <wwn identifier>

Now reload the "scst-service":

# /etc/init.d/scst reload

For "Microsoft Windows XP" download the "iSCSI-Initiator"-software from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=12cb3c1a-15d6-4585-b385-befd1319f825 and connect your guest os (my test was done with "Microsoft Windows XP SP3") to the DVD-target.

Finally you should be able to r/w your DVDs on the hosts DVD-writer from within a virtual Windows-guest.

[slotti, 13.05.2011]