IDE-Device with LUN 1 in #Linux — easy in 2000, #howto in 2023? #followerpower

I’m trying to revive my Phase Change Drive — but fail to get Linux to detect that the ATAPI device supports multiple LUNs. Unfortunately, CD-ROM lives at LUN 0, Phase Change mode at LUN 1 …

I still own a bunch of »PD-M650« media — that’s a rewritable CD-sized optical media which emerged mid-90’s and basically is the technology the DVD-RAM emerged from.

Back in the last century, mid to end of the 90’s, when CD-R was the major option for long-term storage, PD sounded like the superior technology: up to 500.000 times rewritable, tens of years lifetime and more KISS than the emerging MO alternatives. You could use PD media like a removable hard drive, instant and random access to your data. Still slooow compared to HDDs of that time, but much easier to handle than CD-R.

Anyway: I went for a TEAC PD-1 PD-518E, hooked it to my computer’s IDE (PATA) bus … and learned that I can only use it as a CD-ROM drive. Thing with the PD-518E is: the Phase Change drive lives at LUN 1.

/proc/scsi:
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: TEAC Model: PD-1 PD-518E Rev: 1.0E
Type: CD-ROM ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 00 Lun: 01
Vendor: TEAC Model: PD-1 PD-518E Rev: 1.0E
Type: Optical Device ANSI SCSI revision: 02 

Back in the day, some entries in drivers/scsi/scsi_devinfo.c were needed to tell the kernel to actually scan for LUNs on this (emulated ATAPI) device — bit of a nuissance, but, well, »you have the code to fix it«.

The decades came and went, around 2009 I rebuild my workstation with a M4N78 PRO mainboard, but dropped connecting the SPD6004P and the PD-518E as I needed the PATA ports for HDDs. PD-M650 and DVD-RAM media were stored away, the workstation became a generic server and virtualization host — and time moved on.

Sometime in between I fished a brand new PD-518E out the The Bay, one never knows …

Fast forward to 2023. I got a Espirmo P556/E90+ cheap from the local tax authorities, added a JMB363-based PATA adapter to the box and connected my spare PD-518E to it. Installing Debian Bookworm (Debian 12) — LUN 1 isn’t recognized 🙁

Rebuiding the kernel with a modified drivers/scsi/scsi_devinfo.c …

root@stanley:~# grep TEAC /usr/src/linux-source-6.1/drivers/scsi/scsi_devinfo.c  | grep PD
	{"TEAC", "PD-1*", "*", BLIST_FORCELUN | BLIST_SINGLELUN},

… still yields:

root@death:~# grep -i "scsi 0" /var/log/syslog 
2023-08-18T23:32:56.475399+02:00 death kernel: [    2.165763] scsi 0:0:0:0: CD-ROM            PHILIPS  SPD6004P         HP02 PQ: 0 ANSI: 5
2023-08-18T23:32:56.475481+02:00 death kernel: [    2.224692] scsi 0:0:1:0: CD-ROM            TEAC     PD-1 PD-518E     1.0G PQ: 0 ANSI: 5

Even after …

for i in $(ls /sys/class/scsi_host/) ; do echo "- - -" >/sys/class/scsi_host/$i/scan ; done

… there’s no »Optical Device ANSI SCSI revision: 02« being discovered.

root@death:~# uname -a
Linux death 6.1.38 #3 SMP PREEMPT_DYNAMIC Wed Aug 16 01:02:27 IST 2023 x86_64 GNU/Linux

So, before I hook a system with a 2000’s OS to the Internet of 2023 — why isn’t all this SCSI scanning working anymore in contemporary kernels‽