Thanks! I have compiled my own kernel a few times (in the '90s to set the console text mode, and then I guess to enable target mode whenever I played with this last), but that was always just building from the already-installed sources I guess, so I was hoping to avoid learning about having an updated source tree 😁
You guys inspired me! This discussion was super helpful setting up my own PSCSI server for my retro computers, so thank you.
I'll post a full write up soon (with maybe some new learnings?), but I decided to make a webui to handle configuration of images for easy swapping, zfs status, etc.
The attachment retroscsi.png is no longer available
ahyeadudewrote on 2025-08-25, 00:07:> You guys inspired me! This discussion was super helpful setting up my own PSCSI server for my retro computers, so thank you.
> […] Show full quote
> You guys inspired me! This discussion was super helpful setting up my own PSCSI server for my retro computers, so thank you.
>
> I'll post a full write up soon (with maybe some new learnings?), but I decided to make a webui to handle configuration of images for easy swapping, zfs status, etc.
Thanks a lot!! Looking very much forward to it!! Personally, I don't care for the Web-UI, though.
You guys inspired me! This discussion was super helpful setting up my own PSCSI server for my retro computers, so thank you.
I'll post a full write up soon (with maybe some new learnings?), but I decided to make a webui to handle configuration of images for easy swapping, zfs status, etc.
Nice! I look forward to seeing your post. I haven't had a chance to play with this for a long time, so I've forgotten all the commands, and as a result I might find a web UI quite useful 😁
I found most of these components on eBay. The 29160s are still pretty cheap, most were ~$20 each. I'm guessing a lot of these were produced over the years, and these are now pretty niche items. For the case, I bought the most compact 2U chassis I could find from Sliger.
The attachment retroscsibox.jpg is no longer available
Initially one of the 4 29160LP's would not send data over the scsi bus in target mode. It was recognized in FreeBSD, but refused to work. It also happened to be a very new revision (2009 date code, most of the rest were 2002-2006). The main chip is clearly different on this new revision than the others. Not sure, what changed, but it did not work. I recommend sticking with older revisions (2002-2006 have worked for me so far).
New revision
The attachment new29160.jpg is no longer available
Old revision
The attachment old29160.jpg is no longer available
Now onto some FreeBSD configuration. I tried to play around with various kernel options, but these are the bare minimum to get a fully functioning target mode in CTL for 4 cards.
FreeBSD kernel config at "/usr/src/sys/amd64/conf/SCSITARG":
1#!/bin/sh 2cd /usr/src 3sudo sh -c "make buildkernel -j3 KERNCONF=SCSITARG && make installkernel KERNCONF=SCSITARG INSTKERNNAME=SCSITARG"
Add this to "/boot/loader.conf"
1kernel="SCSITARG"
Next we need to create some block devices, ctladm ports, etc. I used zfs zvols as my block devices. These are nice because you can make costless snapshots, rollback to previous versions, etc. This is nice when testing something out on a retromachine and you want to revert back before some large change was made (installing a driver in Windows 95). Instead of using ctld and "/etc/ctl.conf", I opted to use the ctladm commands themselves. See below "/etc/rc.local" (this is run at boot on FreeBSD) for my setup.
It's probably worth noting here, I have set up each of the 4x 29160 cards to exist on SCSI ID:0 in the SCSISelect option rom utility. This will make them present their disks at SCSI ID:0 for each retro machine, which is the typical SCSI ID for the first hard drive.
Also, the above "/etc/rc.local" sets the initial lunmaps for each scsi card/retro machine. The web gui automatically executes "ctladm lunmap" to swap devices after this initial setup in "/etc/rc.local" is complete. It's also worth noting here, that there are two hard rules I've found when dealing with AHC target mode and FreeBSD.
Once a "port" or "card" is enabled, it cannot be disabled and then re-enabled. It will refuse to send data on the SCSI Bus until the server is power-cycled. So once a port is on, leave it on.
Once a "lun" is enabled, it cannot be disabled and then re-enabled. It will refuse to send data on the SCSI Bus until the server is power-cycled. A "lun" can be remapped to swap devices (ie, you want to switch between your DOS image and Windows 98 image), but it cannot be disabled.
This is likely a bug somewhere in the FreeBSD targ code that triggers when putting "ports" or "luns" in and out of target mode. Practically speaking, as long as you avoid the above, it is a non-issue.
I'll wrap up this first post with a couple of benchmarks from my P233MMX machine running Windows 98SE. This machine is using a AHA-2940UW PCI SCSI card. This card is Ultra-Wide, so has a theoretical limit of 40 MB/s.
First using the onboard 430hx IDE (in DMA mode) and a CF card:
The attachment Win98_IDE.png is no longer available
Finally with FreeBSD exported drive:
The attachment Win98_FreeBSD.png is no longer available
As you can see, there is a huge increase from using an IDE/CF card. The machine feels a lot snappier. Also with the storage backed by ZFS, no worrying about bitrot on the CF card over time.
I found most of these components on eBay. The 29160s are still pretty cheap, most were ~$20 each. I'm guessing a lot of these were produced over the years, and these are now pretty niche items. For the case, I bought the most compact 2U chassis I could find from Sliger.
The attachment retroscsibox.jpg is no longer available
Initially one of the 4 29160LP's would not send data over the scsi bus in target mode. It was recognized in FreeBSD, but refused to work. It also happened to be a very new revision (2009 date code, most of the rest were 2002-2006). The main chip is clearly different on this new revision than the others. Not sure, what changed, but it did not work. I recommend sticking with older revisions (2002-2006 have worked for me so far).
New revision
The attachment new29160.jpg is no longer available
Old revision
The attachment old29160.jpg is no longer available
Now onto some FreeBSD configuration. I tried to play around with various kernel options, but these are the bare minimum to get a fully functioning target mode in CTL for 4 cards.
FreeBSD kernel config at "/usr/src/sys/amd64/conf/SCSITARG":
1#!/bin/sh 2cd /usr/src 3sudo sh -c "make buildkernel -j3 KERNCONF=SCSITARG && make installkernel KERNCONF=SCSITARG INSTKERNNAME=SCSITARG"
Add this to "/boot/loader.conf"
1kernel="SCSITARG"
Next we need to create some block devices, ctladm ports, etc. I used zfs zvols as my block devices. These are nice because you can make costless snapshots, rollback to previous versions, etc. This is nice when testing something out on a retromachine and you want to revert back before some large change was made (installing a driver in Windows 95). Instead of using ctld and "/etc/ctl.conf", I opted to use the ctladm commands themselves. See below "/etc/rc.local" (this is run at boot on FreeBSD) for my setup.
It's probably worth noting here, I have set up each of the 4x 29160 cards to exist on SCSI ID:0 in the SCSISelect option rom utility. This will make them present their disks at SCSI ID:0 for each retro machine, which is the typical SCSI ID for the first hard drive.
Also, the above "/etc/rc.local" sets the initial lunmaps for each scsi card/retro machine. The web gui automatically executes "ctladm lunmap" to swap devices after this initial setup in "/etc/rc.local" is complete. It's also worth noting here, that there are two hard rules I've found when dealing with AHC target mode and FreeBSD.
Once a "port" or "card" is enabled, it cannot be disabled and then re-enabled. It will refuse to send data on the SCSI Bus until the server is power-cycled. So once a port is on, leave it on.
Once a "lun" is enabled, it cannot be disabled and then re-enabled. It will refuse to send data on the SCSI Bus until the server is power-cycled. A "lun" can be remapped to swap devices (ie, you want to switch between your DOS image and Windows 98 image), but it cannot be disabled.
This is likely a bug somewhere in the FreeBSD targ code that triggers when putting "ports" or "luns" in and out of target mode. Practically speaking, as long as you avoid the above, it is a non-issue.
I'll wrap up this first post with a couple of benchmarks from my P233MMX machine running Windows 98SE. This machine is using a AHA-2940UW PCI SCSI card. This card is Ultra-Wide, so has a theoretical limit of 40 MB/s.
First using the onboard 430hx IDE (in DMA mode) and a CF card:
The attachment Win98_IDE.png is no longer available
Finally with FreeBSD exported drive:
The attachment Win98_FreeBSD.png is no longer available
As you can see, there is a huge increase from using an IDE/CF card. The machine feels a lot snappier. Also with the storage backed by ZFS, no worrying about bitrot on the CF card over time.
The ability to backup or restore a win9x system with an instantaneous ZFS snapshot is super cool!
Is Poudriere needed to rebuild the kernel? Did the use of a device hint to enable target mode never materialize?
UNIX is a simple, coherent system that pushes a few good ideas and models to the limit.
Ritchie, D. M. Reflections on Software Research. Commun. ACM 27, 8 (August 1984), 758-760.
Is Poudriere needed to rebuild the kernel? Did the use of a device hint to enable target mode never materialize?
No, I just made sure to install the "src" tree during installation, and use the typical compilation command (see my script above). The device hint code did make it into the main branch of FreeBSD. It should be in the FreeBSD 15 release later this year.
Cool, thanks! I really need to try and get this going!
UNIX is a simple, coherent system that pushes a few good ideas and models to the limit.
Ritchie, D. M. Reflections on Software Research. Commun. ACM 27, 8 (August 1984), 758-760.
I got it working! My FreeBSD 14.3 system has an Adaptec AHA-2940U2W installed. The initiator has an Adaptec AHA-1542CP and is running Windows 95.
SCSI ID #6 on the Windows 95 system is a ZFS volume on the FreeBSD system. This is awesome!
Thank you to everyone that contributed information to this thread!
UNIX is a simple, coherent system that pushes a few good ideas and models to the limit.
Ritchie, D. M. Reflections on Software Research. Commun. ACM 27, 8 (August 1984), 758-760.
Has anyone else tried FreeBSD 15-ALPHA5? A hint in /boot/device.hints now works to enable target mode , but I have to manually toggle the port on for it to happen.
When the initiator boots and scans the SCSI bus, it reports device connected, but not ready. At that point the FreeBSD kernel panics.
UNIX is a simple, coherent system that pushes a few good ideas and models to the limit.
Ritchie, D. M. Reflections on Software Research. Commun. ACM 27, 8 (August 1984), 758-760.
I haven't tried it yet. Is the kernel compiled with "targ" and "targbh" options still? I remember during testing that if I omitted any of those the retro machine would see the disks, but then both machines would freeze on boot. Similar to what you are describing.
I think the new device.hints only addresses not having to specify "options AHC_TMODE_ENABLE".
No, it's not. I'll build a new kernel. Thank you for the insight!
UNIX is a simple, coherent system that pushes a few good ideas and models to the limit.
Ritchie, D. M. Reflections on Software Research. Commun. ACM 27, 8 (August 1984), 758-760.