iSCSI under Debian / Devuan

These instructions are written with assistance from https://wiki.debian.org/SAN/iSCSI

iSCSI

iSCSI is a network transport mechanism for exporting block devices between machines.

The block devices themselves are completely standard (there's no "iSCSI header" or similar added to the device itself), which means you can share:

  • CD-ROMs or DVDs
  • existing disk devices containing partitions
  • existing disk partitions containing a file system
  • files containing a disk image
  • LVM Logical Volumes

The device (or file) you're sharing doesn't have to be formatted first (you can readily format it on the client system after sharing it), and it can contain any sort of file system you like (ext, fat, iso9660…)

As far as the client machine is concerned, it simply gets a new /dev/sdX device, which can be used in the usual ways.

Terminology

iSCSI uses the term initiator for the client end (the machine which requests access to the device/s being shared by the server), and target for the server end (which has the real device/s being made available to client machine/s).

Note that iSCSI is a device-level share, not a file-system share, therefore it knows (and cares) nothing about what files are on the device, but it also neither knows nor cares about any local usage of the files on the device, so unless you really know what you're doing, you should never share over iSCSI a device which is already in use (ie: mounted) on the local (server) system.

The iSCSI target service will not stop you doing this.

Configuring the server (target)

There are two ways of doing this, depending on which version of Debian / Devuan you are starting from.

For Debian 8 Jessie / Devuan 1 Jessie and below, you configure the target using iscsitarget.

For Debian 9 Stretch / Devuan 2 Ascii and above, you configure the target using targetcli-fb.

In my opinion iscsitarget is by far easier to work with, and the configuration files are much smaller and easier to read, but unfortunately it's not possible to upgrade a Jessie machine to Stretch / Ascii and keep iscsitarget working. Such is the cost of "progress"…

Configuring the client (initiator)

This is the same for any version of Debian or Devuan, using open-iscsi.

Interesting uses

Fairly obviously, iSCSI can be used to mount a device or partition on a remote machine so that you can use it as though it were local storage (perhaps on a machine which is already full to capacity with physical disks), however there are other purposes for which it can be used:

  • making a CD / DVD drive available across the network as a block device (so, for example, a DVD can be shared as a raw disk, without needing to deal with CSS on the machine it's inserted into and then mounting it as a file system).
  • hosting the root file system for machines (including interesting things like Raspberry Pis) which can boot over a network
  • providing network access to a device (usually an HDD or SSD) which contains a partition type or file system/s which cannot be recognised by the machine it's physically plugged into, so that a machine which can understand the partition or file system can do something with it
    • remember that iSCSI is quite neutral regarding operating system / partition type / file system, so there's nothing to stop you sharing a Novell Netware device from a Debian Linux machine if you have a Netware-capable server somewhere able to connect to it
  • sharing a partition from a server housed in a data centre to a client in another data centre, or a machine at home, so that you have convenient access to either large amounts of storage, or storage which has impressive inbound bandwidth (or both), on a machine which has neither of those things itself
    • See also the section on NAT under the open-iscsi notes.

Go up
Return to main index.