3

I use many old parallel SCSI(-1/-2) devices (many "Fast SCSI-2", 10MB/s, 8 bit wide), which I want to attach to a modern computer via a classic Adaptec PCI SCSI host adapter in "target mode". It should emulate an HD drive of arbitrary size (or better: multiple devices at once). The data lives in image files on real HDDs or RAM.

I've crawled through the web to find any helpful information to make a (probably simple?) goal reality. While it seems that both GNU/Linux and FreeBSD offer such possibilities and also seem to be configured quite easily, there's a serious lack of documentation / man pages here. The two or three proposals I've found online and tried in my local setup all didn't work. So, after weeks of trying, I thought it might be good idea to put my problem here and directly ask professionals.

What I'm NOT after: Anything iSCSI and network target stuff - this is about vintage computing. I know of several different (mostly hardware) solutions, including SCSI2SD, ACARD converters and so on, but those are not providing what I want. I also don't want any kind of embedded solution, hardware hacks etc. - the only solution I'm interested in is the one described above: SCSI card & PC & free / open OS (no Windows solutions for me, please - but you may put them here for others). There's a (rather hacked-together-ish) tool ("scsi_target" IIRC) with free code, that's quite unstable in the long run and slow, too - that's no suitable solution.

What I have: I have an IBM PC with a suitable Adaptec AHA-2940/SE card supporting "target mode". It is also activated in it's BIOS extension and has been given a host ID there. (Open to alternative PCI parallel SCSI host adapter card recommendations if this one was a bad choice) The hard drive contains a recent FreeBSD with a custom kernel (with all modules activated that support / are required for "target mode" SCSI) and a recent headless Ubuntu with SCST.

I got none of those solutions working.

Related links to resources I followed, tried or read only to learn from: https://www.vogons.org/viewtopic.php?t=66955, http://web.archive.org/web/20141021111304/http://www.tenox.net/docs/scsi/the_programmers_guide_to_scsi_brian_sawert.pdf, and http://scst.sourceforge.net/

Common problems: Unfortunately, but naturally of course for this tech, there's some confusion - while searching for information with keywords "Target" / "Target mode", I get lots of hits in the iSCSI-Bubble, which is not my topic here. Even when adding "parallel scsi" / "pscsi". There's a "pscsi scst extension" mentioned on their massively outdated website, but I didn't find anything related to it, apart from some unfinished stuff. By tendence, it's unclear how to write up the config files; often lacking information about options, possible values, their meanings, etc. I lack some knowledge on commands / tools to use for debugging, monitoring and scanning scsi bus and whether the software is configured correctly, too. I also often don't know how to find the correct SCSI bus location (like 1:3:0:0 or only 3:0:0 - I know it's bus:target:lun, but how am I supposed to count / find out / be sure, and what's the first digit on a 4-number path?).

I'd appreciate gaining some knowledge here, getting helpful answers and possibly see some of you put up setup instructions and different example config files for mentioned frameworks / OSses to learn from and eventually get a working system.

Thank you for your attention and stay safe!

3
  • 2
    Possibly the retrocomputing stackexchange would be more appropriate for this question. What driver does your Adaptec get under Linux? Because the driver needs to support target mode to have a chance to get an application running which emulates a harddisk, so the first step is to take a close look at the documentation for the driver.
    – dirkt
    Feb 16, 2021 at 21:35
  • 1
    @dirkt Thank you; I also thought about putting it in retro computing but eventually decided to put it here first. (I hope that's okay for now :-/ ) Concerning the driver: I tried to find any information about target mode and those few bits I came across say it'd be supported by the standard one. Also crawled the kernel's menuconfig for any related option; if I found some, I activated them as far as it made sense and compiled it (don't remember, that happened at the beginning of this odyssey ;) ) .. so: standard driver or standard with target mode options enabled. ("Aic7xxx")
    – Zod
    Feb 16, 2021 at 21:46
  • 1
    @dirkt I edited my question to make clear that the adapter card may be replaced by a more suitable / compatible one, as long as it is PCI bus.
    – Zod
    Feb 16, 2021 at 21:53

2 Answers 2

1

Very very preliminary answer:

Googling for the aic7xxx driver (using aic7xxx target mode keywords) finds this email exchange from 2001, which concerns a AHC_TARGET_MODE define in the source code of the driver. From this, it looks like the driver source code was adapted from BSD for Linux, and target mode at least back then only worked on BSD.

Looking at the driver code current in the Linux kernel still finds the AHC_TARGET_MODE checks, but no file where it is actually defined (unless that happens during some configuration -- I didn't actually try to compile that driver).

So my assumption would be that target mode still doesn't work under Linux, and you need to go to BSD. But I may be wrong here.

The mail mentions that

FreeBSD's SCSI layer (CAM) has explicit support for target mode operations.

I do not know much about FreeBSD, but if this was my project, as the next step I'd install FreeBSD, look at the CAM SCSI layer, see if it already has something to emulate harddrives (likely, Linux has several projects for that, and yes, they also can be used with iSCSI and other SCSI transport mechanisms, so don't dismiss that), and then find out how to connect this to the CAM layer so that the aic7xxx driver is at the other end.

1
  • Yea CAM mode is really just for FreeBSD. It WORKS in a very limited disk emulation. It even looks like at one time Adaptec sold microcode to make it easier to access as a target, but of course it was all commercial software. Jul 18, 2022 at 20:00
1

I am doing the EXACT same thing right now. Trying to build a tape drive emulator but there is really nothing out there. When you dd a tape, your not even truly getting "all" the bytes. Your missing files marks, set marks, partitions and the like. Hell, it annoys me that after 20 years of just "assuming" I find it was completely wrong.

That brings me to now. Believe it or not most or all the older controllers can act as a target. Right now I have a custom ISA driver running on an AIC-6260 that so far is working fine. The hardware is physically capable of it, mainly because they would sell these interface chips to both the user and the drive factory's.

The problem is the drivers and interfaces. If you just search "DMA" under the scsi directly, you will find many of those drivers have "TO_DO" for that feature. I have ran into quite a few bugs where if you do set your hba as a target it can crash the kernel quite hard if you try to switch it back (2920 PCI did that). All those drivers are only touched when some major driver subsystem is changed and we aren't getting rid of sysfs. God I even remember pushing back agents that, how times have changed.

Best bet is to switch to FreeBSD. The aic7xxx originally came from over there and is where the missing file is. It also works with their built in target system. (tg). I haven't used it yet, but I am getting close to switching:P

4
  • Hey Paul, I'm happy for everyone hitting this topic and being interested in interfacing old hardware to current one ;) It's still of interest to me, so when you proceed somehow, I'd love to read anything instructive to get to a point where these things work! Since then, I pursued other ideas, but they involve dedicated hardware and quite some coding, so it's difficult to say if that's going to happen or when.. :-/
    – Zod
    Apr 4, 2022 at 21:30
  • Re. tape: Isn't all this "meta data"? I mean: The tape drive acts quite transparently, i.e. if you request a file, you get it. Marks, partitions and similar information is only for the drive itself to operate and could easily be part of file names when emulating: "tape_barcode-blk_start-blk_end-part_id-file_no-crypto_compress_flags.bin". Don't you only need the payload? I guess nobody would emulate the servo track on each tape, for example. It's about operation and the effective data, to my understanding. I'm using an LTO-4 and -5 here, yet don't see the "assuming" problem you mentioned.
    – Zod
    Apr 17, 2022 at 12:25
  • Sadly thats not the case. IBM saves blocks in variable mode and needs to know the size of each block that can vary. Not to mention hard written marks in the tape denote file changes and even file names. Unless the structure is perfectly replicated, AS400 will just ignore the tape. Hell LTO drives have the same funtuality, and though I doubt IBM would use this same tape format on those, it still could be done. Jul 18, 2022 at 20:08
  • Hi, Paul, I'm interested in realizing the same goal - emulating a SCSI tape drive from a second machine. Do you have a github with any progress or a means of contact?
    – etherfish
    Jan 15, 2023 at 22:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .