iSCSI / OpenSAN instructions?

I see OpenWRT and iSCSI and OpenSAN mentioned. I'd like to do this to one of my external drives so I don't have to listen to the noise at my computer. Also one of my programs refuses to use net shares for storage, only connected drives.

Does anyone have any documentation on how to do this with LEDE? If it's a basic Linux thing, forgive me, I'm a Windows guy. I see the GitHub page for OpenSAN and other than building it and tftp'ing it to the router for install, is there a better way, or package, or directions...? :smiley:

I found some information for Linux but the hard part for me is getting those bits into the router so I can run the commands :frowning: Any tips for this?
http://linux-iscsi.org/wiki/ISCSI

Hi,

May someone with more experience with this correct me if I'm wrong, but I do not think OpenWRT has any of the kernel modules or packages required to make an OpenWRT device an iSCSI target (aka the machine holding the disks).

Since there is no advantage to having an embedded harddisk enclosure, why don't you put together a non-embedded computer, pop in your disks and install Linux on it? Here's a nice how-to for setting up an Ubuntu server to work as an iSCSI target:
https://www.server-world.info/en/note?os=Ubuntu_16.04&p=iscsi&f=2

Keep in mind that iSCSI is SUPER SENSITIVE to latency. A timeout of as much as a few miliseconds will cause a Windows client box to just lock up and just stop working. So do not expect to be able to use it with anything other than wired network, preferably fiber.

LP,
Jure

I found this: http://linux-iscsi.org/wiki/Core-iSCSI

In theory it should be possible if you copy those bits over.

The main reason is I have a NAS with iSCSI holding my backups and recently got a new security camera that does not have self recording ability so I have to run a program on my little server box in my living room. The stupid program won't let you record to network shares as I have a dedicated video drive shared by the NAS. It would be so convenient if I could plug it into the router next to it and attach it via iSCSI.

Are there any alternative protocols that accomplish a network link to a computer and have it think it's a local drive?

Porting a software package designed for x86 to embedded is far from trivial.

It would be easier by far to connect a router to the camera, and capture video / images using Linux, which can save to a network share or whatever. That being said, it might depend on the brand of the camera, if there is a video capture driver. Check this for more info:
https://openwrt.org/docs/guide-user/hardware/video/usb.video

At least in this case though, you would be doing things the conventional way, as self-recording cameras really are just cameras with embedded Linux computers attached to them.

You mean on Windows? Ask on a Windows forum.

Although perhaps you could save to C: and have a script to copy the recordings to a NAS.

LP,
Jure

The OpenWRT page does list iSCSI as an available protocol but that's where the documentation ends unfortunately. The cake is a lie.

https://wiki.openwrt.org/doc/techref/filesystems.network

Edit
I swear I looked online for a tgt package. There is one called that for iSCSI but is not in the catalog so I'd have to do a manual injection if it's built for LEDE.

tgt is a userspace program, so no need for injecting. The kernel modules supposedly part of the kernel for a long time now.

I'm uncertain why the package isn't available for download anywhere, it's possible it's just one of those things so few people need, that you have to build it yourself. I'm going to give it a shot and let you know.

EDIT: It can be done but you need to compile your own kernel with the KERNEL_AIO option enabled (for the option to select "tgt" to even show up in menuconfig). See here:
https://wiki.openwrt.org/doc/howto/build

And get up to speed with compiling OpenWRT from source. You will need a 64-bit system running Linux. In Menuconfig, select KERNEL_AIO and then the "tgt" package under Network. Also select other packages you intend to use, as public package repositories cannot be used with a custom kernel. Make and enjoy.

Good luck.

LP,
Jure

Did a search for iSCSI before posting but somehow it didn't find this post:

Looks like you cross compile with OpenWRT?

Oh and thanks for the compile information. I'll see about setting up a VM to compile it. I should have a Linux VM tucked away anyway for those rare occasions I need it.

All OpenWRT code is cross-compiled because you are not running the same architecture on the PC as on the router. Also no need to throw around buzzwords, just follow the instructions on the page, follow them and you are the most likely to end up with a non-bricked device.

LP,
Jure

I spent an hour trying to find the package and it's just not there. Search can find it and tells me it's in the "Network" root but it's not.

What am I missing?

Says depends on Kernel_AIO and I can't find that either if it's a requirement to have tgt show up.

VirtualBox_Lubuntu_20_05_2018_18_09_42

VirtualBox_Lubuntu_20_05_2018_18_08_56

I found an interesting package while digging just now called "USBIP" which shares a USB device over the network and it has a Windows client. This might be simpler to implement so I'll take a look when I get home tonight.

Honestly this is a pretty amazing project if it works. It could be used for any USB device!

http://usbip.sourceforge.net/

I got tgt to show up. I didn't know what AIO meant and was looking for a package. You have to add the "Compile the kernel with asynchronous IO support" under "global build options" > "kernel build options". Then tgt will show up under network.

Building now... Didn't expect it to take so long to build. Still going after 2 hours lol.

The build keeps failing. Gets to the final compile and fails error:1 Running in debug now...

If you haven't already done so, you might try enabling ccache for your development builds, as well as using something like

make -j5 clean download world

(assuming that it is building, otherwise a single-threaded make V=s is "needed" to make sense of the diagnostic output)

I'm kind of lost. It's still not working. Found I was out of drive space and increased it but it's still failing.

VirtualBox_Lubuntu_21_05_2018_12_24_46

After much struggle and many hours of failed builds I finally have a working firmware. It seems the usbip package has an issue and there was an unknown issue possibly another bad package there as well. But I can confirm the tgt package is responding to commands. Going to have to figure out how to set this up but I'm happy for now. Just bought a new router, a Turris Omnia so I'll probably be at square one if it's not included in their package by default LOL!