iSCSI Boot - ArchWiki

# iSCSI Boot

This article or section needs expansion.

Reason: please use the first argument of the template to provide a brief explanation. (Discuss)

The factual accuracy of this article or section is disputed.

Reason: The actual boot will use an extra drive / usb drive or pxe boot? (Discuss)

Related articles

- iSCSI Target
- iSCSI Initiator

You can install Arch on an iSCSI Target. This howto will guide you through the process.

## Server / Target Setup

You can set up an iSCSI target with any hosting server OS. Follow the procedure outlined in iSCSI Target if you use Arch Linux as the hosting server OS.

## Client / Initiator Setup

### Overview

1. install open-iscsi package in installer system

2. connect to iSCSI target and create partitions on logical drive of target.

3. install Arch Linux system in usual way

4. install open-iscsi package in installed system

5. create initial RAM disk image containing open-iscsi modules.

Note: In addition to the above, you have to prepare sanboot-able infrastructure which is necessary to load boot loader (GRUB, etc.) from remote disc. Some network interface cards support sanboot. If you don't have such cards, you can use iPXE, gPXE, and so on.

### Install over iSCSI

Download Arch Linux ISO image [1] and boot Arch Linux using the ISO image. After Arch Linux is booted, either use net as the install source or manually ifconfig and dhcp.

1. Unfortunately ISO install image does not include modules for iSCSI, you have to install and setup them at first.

Before you continue to "Partition the disks", install the open-iscsi package from the official repositories and connect to target.

In the following, server's(target's) IP address is 192.168.1.100, client's(initiator's) IP address is 192.168.1.101, iSCSI initiator name is "iSCSI.Initiator.Name" and target name is "iSCSI.Target.Name". You should, of course, be sure to your network configration and so on.

    pacman -Sy
    pacman -S open-iscsi
    modprobe iscsi_tcp

2. Connect to iSCSI target.

    iscsistart -i iSCSI.Initiator.Name -t iSCSI.Target.Name -g 1 -a 192.168.1.100

Now your local host connects to the drive of target host (see dmesg output).

(Optional) If you want to make sure that your iSCSI target is up and running, you may start "iscsid" and check whether the iSCSI target is available.

    # iscsid
    # iscsiadm -m discovery -t sendtargets -p 192.168.1.100

Note: It is recommended that you NOT include swap on the iSCSI drive when creating the partitions, you can just ignore the warning.

3. You can create a partition table and partitions in the same way as a local drive. And continue to install Arch Linux in the usual way.

4. Install the open-iscsi package in the "future" root file system.

    pacman -Sy
    pacman -S open-iscsi

5. Before doing mkinitcpio in the "future" root file system, you have to prepare the following two files and have to install open-iscsi package.

i) `/mnt/usr/lib/initcpio/install/iscsi`

    build ()
    {
        local mod
        for mod in iscsi_tcp libiscsi libiscsi_tcp scsi_transport_iscsi crc32c; do
            add_module "$mod"
        done

        add_checked_modules "/drivers/net"
        add_binary "/usr/bin/iscsistart"
        add_runscript
    }

    help ()
    {
    cat <<HELPEOF
      This hook allows you to boot from an iSCSI target.
    HELPEOF
    }

ii) `/mnt/usr/lib/initcpio/hooks/iscsi`

    run_hook ()
    {
        modprobe iscsi_tcp
        ifconfig eth0 192.168.1.101 netmask 255.255.255.0 broadcast 192.168.1.255
        sleep 10
        iscsistart -i iSCSI.Initiator.Name -t iSCSI.Target.Name -g 1 -a 192.168.1.100
    }

If you want to use dhcp for the above script, you may try to replace the "ifconfig" line with "dhcpcd eth0", but make sure that dhcpcd is installed.

Add "iscsi" to the HOOKS line in /etc/mkinitcpio.conf.

Then run "mkinitcpio -p linux" and new `/boot/initramfs-linux.img` and `/boot/initramfs-linux-fallback.img` will be generated.

Note: If you plan on booting this installation of Arch on machines with nic cards that require different modules, remove "autodetect" from HOOKS
Note: Rebuilding the initial ramdisk will take some time if autodetect is removed from HOOKS

Now your new system can mount the file systems from iSCSI target drive after reboot.

## Troubleshooting

### Device not found

If you are having problems with detecting your eth0 interface, simply install mkinitcpio-nfs-utils package from the official repositories and dhcpcd on your iSCSI drive and add net HOOK to /etc/mkinitcpio.conf.

Also add ip=::::::dhcp to your kernel parameters and now you can use dhcpcd eth0 as described before.

For more informations, please refer to [2].

Categories:

- Getting and installing Arch
- Networking
- Storage