iSCSI Target Box

    I want to bring to your attention an interesting iSCSI Target Box project - a Linux mini-distribution that allows you to quickly deploy an iSCSI server (the so-called Target) on any supported hardware.
    It is based on Arch Linux and its Mkinitcpio initrd image generation script, which allows you to quickly and easily rebuild it when updating the kernel or its other components. In fact, this is the Linux + BusyBox + iSCSI Enterprise Target kernel packed into the Initrd image and the necessary configuration files taken out.


    Download the binary image of the system from the site , unpack it to the root of the boot disk (HDD, USB Flash, Memory Card, etc.), install grub there (or any other favorite boot manager) and set the Linux kernel boot in its config:
     title Linux iSCSI Target Box
     root (hd0.0)
     kernel / vmlinuz26 root = / dev / sdb1 ro ip =::::: eth0: none
     initrd /initrd-iscsi.img

    Where / dev / sdb1 is the name of the partition at the root of which iscsi-target-etc directory with configuration files is located. And ip = ::: - network settings.
    Read more about kernel parameters in the documentation for Mkinitcpio


    All mutable settings are located in the iscsi-target-etc directory which should be located in the root of the partition specified when the kernel is loaded. The contents of this directory at startup are simply copied to / etc and may contain any Linux environment configuration files. If the rc.local file is present in the copied files, then it starts after copying, thus allowing you to additionally configure the environment for yourself without rebuilding the system image.
    Configuring the iSCSI Enterprise Target daemon is located in the / iscsi-target-etc / iet / directory, which is copied at boot to / etc / iet / and requires preconfiguration. For example, we can write such lines in the ietd.conf file :
    Lun 0 Path = / dev / sda, Type = blockio, ScsiId = xyz, ScsiSN = xyz

    Which allows you to share the drive / dev / sda as a block device.

    You can also manage the daemon dynamically using the ietadm administration utility. For example, create a Target with the command:
    ietadm --op new --tid = 1 --params Name =
    and add LUN to it:
    ietadm --op new - tid = 1 --lun = 0 --params Path = / dev / sda, Type = blockio
    Read more about configuring iSCSI Enterprise Target in its documentation.

    Access to the console is possible either directly or via telnet. The default password for root is 666666.
    To change the password, we simply place the shadow file in the iscsi-target-etc directorywith the new password generated for root and when the system boots, it will overwrite the one that is wired into the image.

    So, as you can see, deploying an iSCSI server for data backup or virtualization systems is easy and takes a few minutes. True, the project has just begun to develop, and therefore in production its use is not yet recommended.


    All scripts used for assembly are available in source code under the GPLv2 license. To build the image, you need Arch Linux with the mkinitcpio and mkinitcpio-nfs-utils packages installed. It is also necessary to install the iSCSI Enterprise Target, which can be taken from AUR - iscsitarget-kernel and iscsitarget-usr or download the latest version sources from the official website and compile manually:
    tar xf iscsitarget-
    cd iscsitarget-
    make install

    Then we download the archive with source codes from the iSCSI Target Box project site , unpack it into the / lib / initcpio / directory and create a hardlink to the installation script for the base system:
    ln base-iscsi ../install/base-iscsi

    We generate an image:
    mkinitcpio -c /lib/initcpio/iscsi-target-box/mkinitcpio.conf -g /boot/initrd-iscsi.img

    You can quickly check the health of the assembly using QEMU:
    qemu -snapshot -kernel / boot / vmlinuz26 -initrd /boot/initrd-iscsi.img

    Also popular now: