2009年10月24日 星期六

iSCSI initiator on Ubuntu

Ref: http://www.cyberciti.biz/faq/howto-setup-debian-ubuntu-linux-iscsi-initiator/

Here are procedures to mount a iSCSI disk drive. I've tested it on Ubuntu 8.10:
  1. Install the open-iscsi package via apt-get

  2. Edit /etc/iscsi/iscsid.conf, below is my configuration:

    (You may read the original /etc/iscsi/iscsid.conf for more details)

    node.startup = automatic
    # it seems specify to use CHAP exactly will not work!? really strange!
    #node.session.auth.authmethod = CHAP
    node.session.auth.username = your-username
    node.session.auth.password = your-password
    discovery.sendtargets.auth.username = your-username
    discovery.sendtargets.auth.password = your-password
    node.session.timeo.replacement_timeout = 120
    node.conn[0].timeo.login_timeout = 15
    node.conn[0].timeo.logout_timeout = 15
    node.conn[0].timeo.noop_out_interval = 10
    node.conn[0].timeo.noop_out_timeout = 15
    node.session.initial_login_retry_max = 4
    node.session.iscsi.InitialR2T = No
    node.session.iscsi.ImmediateData = Yes
    node.session.iscsi.FirstBurstLength = 262144
    node.session.iscsi.MaxBurstLength = 16776192
    node.conn[0].iscsi.MaxRecvDataSegmentLength = 131072
    discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
    # allow the targets to control the setting of the digest checking
    node.conn[0].iscsi.HeaderDigest = CRC32C,None
    node.conn[0].iscsi.DataDigest = CRC32C,None

  3. Restart open-iscsi by: /etc/init.d/open-iscsi restart

  4. Discover the iscsi host by:
    iscsiadm -m discovery -t sendtargets -p ISCSI-SERVER-IP-ADDRESS
    It should return the available targets, e.g.,
    192.168.1.xx:3260,1 iqn.2009-10.Zebra:iscsi1

  5. Login the target you want to use by:
    iscsiadm -m node -T iqn.2009-10.Zebra:iscsi1 -p 192.168.1.33 -l
    There should be no error messages if the configuration is correct.

  6. Restart open-iscsi, again. The target you'd like to use should be automatically logged in and you can find its device name by dmesg or /var/log/messages.

  7. Suppose its device name is /dev/sdb, create a partition: fdisk /dev/sdb

  8. Format the partition: mke2fs -j /dev/sdb

  9. Finally, mount it by:
    mount -t ext3 /dev/sdb /path/to/your/mount/point

That's all. Enjoy it!


4 則留言: