ISCSI/Boot

From ArchWiki
< ISCSI
Revision as of 02:16, 27 December 2014 by Takamachi (talk | contribs) (Install over iSCSI)
Jump to navigation Jump to search

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:ISCSI/Boot#)

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The actual boot will use an extra drive / usb drive or pxe boot? (Discuss in Talk:ISCSI/Boot#)

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.

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.

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.2.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
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). You can create a partition table and partitions in the same way as a local drive.

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

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

1. /mnt/usr/lib/initcpio/install/iscsi: It should look like the following.

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
}

2. /mnt/usr/lib/initcpio/hooks/iscsi: It should look like the following.

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.

Install the open-iscsi package in the "future" root file system. Of cource, you have to set up and bring up network interface of "future" system previously.

pacman -Sy
pacman -S open-iscsi

Add "iscsi" to the HOOKS line in /etc/mkinitcpio.conf and run "mkinitcpio -p linux". A new initial RAM disk(initramfs) 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].