Difference between revisions of "ISCSI Boot"

From ArchWiki
Jump to: navigation, search
(use https for links to archlinux.org)
(Install over iSCSI)
Line 31: Line 31:
wget https://aur.archlinux.org/packages/open-iscsi/open-iscsi.tar.gz
wget https://aur.archlinux.org/packages/op/open-iscsi/open-iscsi.tar.gz
tar xzvf open-iscsi.tar.gz
tar xzvf open-iscsi.tar.gz

Revision as of 08:45, 29 December 2012

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#)
Template:Box YELLOW

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end

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

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.

Now before you continue to "Prepare Hard Drive(s)" install open-iscsi and connect to target.

Be sure to your servers IP address, Name, etc.

wget https://aur.archlinux.org/packages/op/open-iscsi/open-iscsi.tar.gz

tar xzvf open-iscsi.tar.gz

cd open-iscsi

pacman -Sy

pacman -S patch make gcc

makepkg --asroot

pacman -U open-iscsi...pkg.tar.xz

modprobe iscsi_tcp

iscsistart -i iqn.2010-06.ClientName:desc -t iqn.2010-06.ServerName:desc -g 1 -a

During the above procedures, if "pacman -Sy" asks you to upgrade pacman, answer "no" otherwise pacman may fail to install patch, make, and gcc, which are essential to the compilation of the open-iscsi source.

(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 <server-IP>

Continue to prepare the hard drive, using the iSCSI target drive. It is suggested that you manually create a partition that uses the entire iSCSI target drive.

Note: When you "Manually Configure block devices, filesystems and mountpoints" make sure that you use UUID. This way there won't be any issues booting if the number of devices changes (/dev/sda /dev/sdb ...) by adding or removing hard drives, usb thumb drives, etc... or booting it on different machines.
Note: It is recommended that you NOT include swap on the iSCSI drive when creating the partitions, you can just ignore the warning.

Before you "Configure System" you must install open-iscsi to the "future" root filesystem, and download and install the hook for booting from iSCSI. This should be done after all selected packages are installed.

Create these hook files, replacing the IP, etc. You may create these hook files after open-iscsi is installed to the "future" root filesystem.

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

# vim: set ft=sh:

build ()
    MODULES="iscsi_tcp libiscsi libiscsi_tcp scsi_transport_iscsi crc32c $(checked_modules "/drivers/net/") "

help ()
  This hook allows you to boot from an iSCSI target.

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

# vim: set ft=sh:

run_hook ()
    modprobe iscsi_tcp
    ifconfig eth0 netmask broadcast
    sleep 10
    iscsistart -i iqn.2010-06.ClientName:desc -t iqn.2010-06.ServerName:desc -g 1 -a

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.

Now, you can install open-iscsi into the "future" root filesystem.

mv open-iscsi...pkg.tar.xz /mnt/root

chroot /mnt/ /bin/bash

cd /root/

pacman -U open-iscsi...pkg.tar.xz

Now you can create the above hook files by pasting the above scripts.

nano /lib/initcpio/install/iscsi

nano /lib/initcpio/hooks/iscsi


Now you are ready to "Configure System." Most of the configuration files can remain unchanged.

Add "iscsi" to the HOOKS in /etc/mkinitcpio.conf. The "mkinitcpio" will generate a new kernel image after you are done with "Configure System."

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

When configuring grub find the lines for Arch that are

root (hdX,0)

and change to

root (hd0,0)