iscsi
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | iscsi [2014/11/24 01:14] (current) – created 0.0.0.0 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== ISCSI ====== | ||
+ | ===== Overview ===== | ||
+ | ===== Server ===== | ||
+ | ==== Installation ==== | ||
+ | The following kernel options are required: | ||
+ | {{Kernel|2.6.29-gentoo-r1|< | ||
+ | |||
+ | Now install the iSCSI Enterprise Target packages: | ||
+ | * {{Package|direct=yes|sys-block/ | ||
+ | |||
+ | Load the necessary modules, and make sure they are automatically loaded on boot: | ||
+ | {{Root|< | ||
+ | modprobe crc32c | ||
+ | modprobe iscsi_trgt | ||
+ | </ | ||
+ | {{File|/ | ||
+ | modules_2_6=" | ||
+ | module_crc32c_2_6="" | ||
+ | module_iscsi_trgt_2_6="" | ||
+ | </ | ||
+ | |||
+ | ==== Configuration ==== | ||
+ | Create an LVM partition to share, for example, a 10Gb partition named < | ||
+ | {{Root|< | ||
+ | lvcreate -L10G -n data pool | ||
+ | </ | ||
+ | |||
+ | Edit < | ||
+ | {{File|/ | ||
+ | Target iqn.2006-06.net.sihnon.jellybean.badger: | ||
+ | Lun 0 Path=/ | ||
+ | </ | ||
+ | |||
+ | Now start < | ||
+ | {{Root|< | ||
+ | / | ||
+ | rc-update add ietd default | ||
+ | </ | ||
+ | |||
+ | ===== Client ===== | ||
+ | ==== Installation ==== | ||
+ | We will be using < | ||
+ | {{Kernel|2.6.29-gentoo-r1|< | ||
+ | |||
+ | Install the client software: | ||
+ | * {{Package|direct=yes|sys-block/ | ||
+ | |||
+ | ==== Configuration ==== | ||
+ | Configure the targets, and have them loaded automatically: | ||
+ | {{File|/ | ||
+ | InitiatorName=iqn.2006-06.net.sihnon.jellybean.badger: | ||
+ | </ | ||
+ | {{File|/ | ||
+ | - node.startup = manual | ||
+ | node.startup = automatic | ||
+ | </ | ||
+ | |||
+ | Configure the networking for open-iscsi. Find the MAC address for the network interface you'd like to use using < | ||
+ | {{Root|< | ||
+ | iscsiadm -m iface -I iface0 --op=new | ||
+ | iscsiadm -m iface -I iface0 --op=update -n iface.hwaddress -v AA: | ||
+ | </ | ||
+ | |||
+ | Now start iscsid, and have it autostart on boot. | ||
+ | {{Root|< | ||
+ | / | ||
+ | rc-update add iscsid default | ||
+ | </ | ||
+ | |||
+ | When iscsi targets are attached, a corresponding block device will be created in < | ||
+ | {{Root|< | ||
+ | fdisk /dev/sdb | ||
+ | mke2fs -j /dev/sdb1 | ||
+ | </ | ||
+ | |||
+ | === Renaming targets === | ||
+ | The device node that's created for a particular iscsi target is volatile, and depends on the state of the system when the target is first attached. We can use < | ||
+ | {{File|/ | ||
+ | #!/bin/bash | ||
+ | DEV=`echo $1 | /bin/awk -F":" | ||
+ | LUN=`echo $1 | /bin/awk -F":" | ||
+ | |||
+ | for i in / | ||
+ | test -d " | ||
+ | done | ||
+ | </ | ||
+ | {{File|/ | ||
+ | BUS==" | ||
+ | </ | ||
+ | |||
+ | Now that devices nodes are accessible at known locations, we can add an entry to fstab to make the partition mountable. The entry //must// have the < | ||
+ | {{File|/ | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | === Automatically mounting volumes === | ||
+ | If we want to automatically mount these filesystems after iscsid has started, we will need to use a custom init script as there does not appear to be any exiting way to do this. Add the following scripts. The latest version of the init script is held in subversion, under [[https:// | ||
+ | {{File|/ | ||
+ | - List of volumes to mount | ||
+ | |||
+ | VOLUMES=( | ||
+ | "/ | ||
+ | ) | ||
+ | |||
+ | - Amount of time to sleep before mounting volumes, so that iscsid has time to | ||
+ | - create any device nodes after connecting. | ||
+ | |||
+ | SLEEP=" | ||
+ | </ | ||
+ | {{File|/ | ||
+ | # | ||
+ | - Copyright 1999-2009 Gentoo Foundation | ||
+ | - Distributed under the terms of the GNU General Public License v2 | ||
+ | - $Header: $ | ||
+ | |||
+ | depend() { | ||
+ | need iscsid | ||
+ | } | ||
+ | |||
+ | start() { | ||
+ | STATUS=0 | ||
+ | ebegin " | ||
+ | eindent | ||
+ | |||
+ | einfo " | ||
+ | sleep ${SLEEP} | ||
+ | |||
+ | for v in ${VOLUMES[[@]]}; | ||
+ | RESULT=`mount $v` | ||
+ | if [[|$? ]]; then | ||
+ | einfo " | ||
+ | else | ||
+ | ewarn " | ||
+ | STATUS=1 | ||
+ | fi | ||
+ | done | ||
+ | |||
+ | eoutdent | ||
+ | eend $STATUS | ||
+ | } | ||
+ | |||
+ | stop() { | ||
+ | ebegin " | ||
+ | eindent | ||
+ | |||
+ | for v in ${VOLUMES[[@]]}; | ||
+ | RESULT=`umount $v` | ||
+ | if [[|$? ]]; then | ||
+ | einfo " | ||
+ | else | ||
+ | ewarn " | ||
+ | fi | ||
+ | done | ||
+ | |||
+ | eoutdent | ||
+ | eend 0 | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Finally, add the < | ||
+ | {{Root|< | ||
+ | / | ||
+ | / | ||
+ | rc-update add iscsi-volumes default | ||
+ | </ | ||
+ | |||
+ | ===== See Also ===== | ||
+ | * [[ISCSI Enterprise Target]] - Guide to installing IET on ubuntu, and sharing a virtual disk to a windows machine. | ||
+ | * http:// |
iscsi.txt · Last modified: by 0.0.0.0