<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>榆树网 &#187; ISCSI</title>
	<atom:link href="http://www.wenzk.com/archives/tag/iscsi/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wenzk.com</link>
	<description>http://www.wenzk.com</description>
	<lastBuildDate>Thu, 09 Feb 2012 07:57:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>FreeBSD iSCSI Initiator Installation and Configuration</title>
		<link>http://www.wenzk.com/archives/519</link>
		<comments>http://www.wenzk.com/archives/519#comments</comments>
		<pubDate>Sat, 02 Jan 2010 00:03:29 +0000</pubDate>
		<dc:creator>ELM</dc:creator>
				<category><![CDATA[榆树网-系统]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[ISCSI]]></category>
		<category><![CDATA[iscsi-initiator]]></category>
		<category><![CDATA[Storage]]></category>

		<guid isPermaLink="false">http://www.wenzk.com/?p=519</guid>
		<description><![CDATA[Q. How do I install and configure iSCSI initiator service under FreeBSD server? A. FreeBSD 7.x has full support for iSCSI. Older version such as FreeBSD 6.3 requires backport for iSCSI. Following instruction are known to work under FreeBSD 7.0 only. FreeBSD iscsi_initiator driver The iscsi_initiator implements the kernel side of the Internet SCSI (iSCSI) [...]]]></description>
			<content:encoded><![CDATA[<p>Q. How do I install and  configure iSCSI initiator service under FreeBSD server?</p>
<p>A. FreeBSD 7.x has full  support for iSCSI. Older version such as FreeBSD 6.3 requires backport  for iSCSI. Following instruction are known to work under<strong> FreeBSD  7.0</strong> only.</p>
<p><span id="more-519"></span></p>
<h2>FreeBSD iscsi_initiator driver</h2>
<p>The iscsi_initiator implements the kernel side of the Internet SCSI   (iSCSI) network protocol standard, the user land companion is  iscontrol  and permits access to remote virtual SCSI devices via cam.</p>
<h3>Compile driver</h3>
<p>Please note that FreeBSD 7.x has this driver compiled by default. You  can skip this step if driver exists at /boot/kernel/iscsi_initiator.ko. To compile this  driver into the kernel,<br />
<code># cd /usr/src/sys/i386/conf<br />
# cp GENERIC ISCSIKERNEL<br />
# vi ISCSIKERNEL</code><br />
Place the following lines in your kernel configuration file:<br />
<code>device iscsi_initiator</code><br />
Save and close the file. Building a Kernel, type the following commands:<br />
<code># cd /usr/src<br />
# make buildkernel KERNCONF=ISCSIKERNEL</code><br />
Install the new kernel:<br />
<code># make installkernel KERNCONF=ISCSIKERNEL</code><br />
Now reboot the system:<br />
<code># reboot</code></p>
<h2>Install iSCSI Initiator driver under FreeBSD</h2>
<p>You need FreeBSD kernel driver for the iSCSI protocol. You need to  use driver called /boot/kernel/iscsi_initiator.ko. You can <a href="http://www.cyberciti.biz/tips/freebsd-how-to-load-device-driver-module-in-kernel.html">load  this driver</a> by typing following command as root user:<br />
<code># kldload -v iscsi_initiator.ko</code><br />
Output:</p>
<pre>Loaded iscsi_initiator.ko, id=6</pre>
<p>Alternatively, to load the driver as a module at boot time, place the  following line in /boot/loader.conf:<br />
<code># vi /boot/loader.conf</code><br />
<code># Beginning of the iSCSI block added by Vivek<br />
iscsi_initiator_load="YES"<br />
# End of the block added by Vivek</code><br />
Save and close the file.</p>
<h2>FreeBSD  iscontrol command to login / negotiator / control for an  iSCSI initiator session</h2>
<p>Now, you need to use iscontrol command. First, do a discovery session  and exit:<br />
<code># iscontrol -d targetaddress=iSCSI-SERVER-IP-ADDRESS  initiatorname=nxl<br />
# iscontrol -v -d targetaddress=192.168.1.100 initiatorname=nxl</code><br />
Please note down the list of available targetnames/targetadresses. Once  you know the target name, edit /etc/iscsi.conf file:<br />
<code># vi /etc/iscsi.conf</code><br />
Append config directives as follows:</p>
<pre>officeiscsi {
        authmethod      = CHAP
        chapIName       = YOUR-ISCSI-USERNAME
        chapSecret      = YOUR-ISCSI-PASSWORD
        initiatorname   = nxl
        TargetName      = iqn.XYZZZZZZZZZZZZZ #  whatever "iscontrol -v -d " gives you
        TargetAddress   = 192.168.1.100:3260,1 # your iscsi server IP
}</pre>
<p>Save and close the file.<br />
Where,</p>
<ul>
<li><strong>officeiscsi { </strong> : Start config for iSCSI.</li>
<li><strong>authmethod</strong> : Set authentication method to chap</li>
<li><strong>chapIName</strong> : Your username</li>
<li><strong>chapSecret</strong> : Your password</li>
<li><strong>initiatorname</strong> : if not specified, defaults to  iqn.2005-01.il.ac.huji.cs:&lt;hostname&gt;</li>
<li><strong>TargetName</strong> : is the name by which the target is  known, not to be confused with target address, either obtained via the  target administrator, or from a discovery session.</li>
<li><strong>TargetAddress</strong> :  is of the form  domainname[:port][,portal-group-tag] to  quote the RFC: The domainname  can be specified as either a DNS host name, a dotted-decimal IPv4  address, or a bracketed IPv6 address as specified in [RFC2732].</li>
<li><strong>}</strong> : End of config</li>
</ul>
<h2>Start an iSCSI session</h2>
<p>The following command will read options from /etc/iscsi.conf, use the  targetaddress found in  the block nicknamed myiscsi, login and  negotiate whatever options are specified, and start an iscsi-session.<br />
<code># iscontrol -c /etc/iscsi.conf -n officeiscsi</code><br />
Once you run the iscontrol command it should create a new device in /dev  directory. To see the device name run dmesg command:<br />
<code># dmesg </code></p>
<h3>Format iSCSI volume</h3>
<p>Now run sysinstall command to format just discovered iSCSI device  name at /dev location:<br />
<code># sysinstall </code><br />
Select Custom &gt; 3 Partition &gt; Select iSCSI device name such as  da1. Once formatted just mount device, enter:<br />
<code># mkdir /iscsi<br />
# mount /dev/da1s1 /iscsi </code><br />
You may also need to update /etc/fstab file:<br />
<code>/dev/ad1s1              /iscsi          ufs     rw              3        3</code></p>
<p>From: http://www.cyberciti.biz/faq/freebsd-iscsi-initiator-howto/</p>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://www.wenzk.com/archives/1101" title="ZFS Tuning Guide">ZFS Tuning Guide</a> (0)</li><li><a href="http://www.wenzk.com/archives/1096" title="Re: Freebsd 8.0 kmem map too small">Re: Freebsd 8.0 kmem map too small</a> (0)</li><li><a href="http://www.wenzk.com/archives/1092" title="Freebsd 8.0 kmem map too small">Freebsd 8.0 kmem map too small</a> (0)</li><li><a href="http://www.wenzk.com/archives/819" title="使用freebsd构建pppoe server服务器">使用freebsd构建pppoe server服务器</a> (0)</li><li><a href="http://www.wenzk.com/archives/817" title="基于freebsd建立内核模式的pppoe服务器">基于freebsd建立内核模式的pppoe服务器</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wenzk.com/archives/519/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

