Skip to content

Preconfigured Raspberry Pi 4 image to connect to an iSCSI Target and share it as a regular USB-OTG Mass Storage device.

License

Notifications You must be signed in to change notification settings

jwmullally/openwrt-rpi4-iscsi-to-usb-bridge

Repository files navigation

openwrt-rpi4-iscsi-to-usb-bridge

Overview

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.

Requirements

  • 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.

Installing

Download a disk image from the releases, flash it to an SD card and boot it in your Raspberry Pi 4.

Usage

Configuring

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.

Admin UI Commands

iSCSI-to-USB bridge

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 the g_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.

USB-to-iSCSI bridge or iSCSI-to-iSCSI proxy

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.

Performance

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.

Supported devices

The following Makefiles are included by default:

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.

Building

Debian/Ubuntu

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.

Reference

iscsiadm(8).

g_mass_storage.

OpenWrt - Raspberry Pi.

OpenWrt - USB Guest Configuration.

OpenWrt - Image Builder.

Author

Copyright (C) 2022 Joseph Mullally

License: GPLv2

Project: https://github.com/jwmullally/openwrt-rpi4-iscsi-to-usb-bridge

About

Preconfigured Raspberry Pi 4 image to connect to an iSCSI Target and share it as a regular USB-OTG Mass Storage device.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages