This repository contains a preconfigured Raspberry Pi 4 image that functions as an iSCSI-to-USB bridge by connecting to an iSCSI Target block device and sharing it as regular USB Mass Storage through the USB-C OTG port.
This is useful when you have iSCSI Targets running on a network and want to access the storage from a device that supports USB storage but has no network connectivity or iSCSI Initiator support.
-
A Raspberry Pi 4 B.
- Or a similar device with USB-OTG/device-mode support, see below.
-
A USB-A to USB Type-C cable.
-
An iSCSI Target server available over Ethernet.
Download a disk image from the releases, flash it to an SD card and boot it in your Raspberry Pi 4.
By default a Wireless SSID network is created called owrt-iscsi-usb
that you can connect to and access the admin UI on http://192.168.1.1 or via ssh 192.168.1.1
.
You can change the network settings for the Ethernet connection using the OpenWrt Admin UI.
When booted:
/etc/init.d/open-iscsi
iSCSI initiator will automatically connect to the previously configured iSCSI targets in/etc/iscsi
./etc/init.d/usb-otg
will find all iSCSI block devices and register them with theg_mass_storage
USB Gadget Mass Storage driver.
When the Pi is plugged via the USB-C OTG connector into the USB port of another computer, after a few seconds of powering up the iSCSI target block devices will automatically appear to the computer as USB Mass Storage.
To connect to a different iSCSI Target, modify /usr/sbin/iscsi-configure.sh
and re-run the script, which will replace the current settings in /etc/iscsi
.
An iSCSI Target server /etc/init.d/tgt
is also included which can be used to share locally attached storage via iSCSI. This is disabled by default. It can be configured by:
- Edit
/etc/config/tgt
- Start the service with
/etc/init.d/tgt enable; /etc/init.d/tgt start
.
Benchmark setup:
- Hardware: Raspberry Pi 4 B Rev 1.4, 8 GB.
- iSCSI Target:
tgtd
in KVM, virtio storage backed by SSD. - Ethernet: 1 GB/s (iperf3 test: 943 MB/s)
- USB: 3.0.
Results:
- Throughput: ~41 MB/s.
- Latency 0.6 ms.
The following Makefiles are included by default:
-
Makefile.rpi-4
: Raspberry Pi 4 Model B -
Makefile.radxa_rock-pi-4a
: Radxa ROCK 4 -
Makefile.x86-64
: Generic x86-64 QEMU test image
For other devices with USB OTG/device-mode that are supported by OpenWrt, you can copy Makefile.rpi-4
and adjust /etc/uci-defaults/05-usb-otg
, then follow the Build instructions below.
sudo make -f Makefile.common deps-debian
make -f Makefile.rpi-4 images
To install the build dependencies for other distributions, follow the OpenWrt Image Builder instructions.
OpenWrt - USB Guest Configuration.
Copyright (C) 2022 Joseph Mullally
License: GPLv2
Project: https://github.com/jwmullally/openwrt-rpi4-iscsi-to-usb-bridge