當做 iSCSI 的 target

回覆文章
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

當做 iSCSI 的 target

文章 yehlu »

http://www.aspdeveloper.net/tiki-index. ... etOnUbuntu

HOWTO: Setup an iSCSI Target Server on Ubuntu print
similar slides comment
I found a lot of obsolete tutorials about how to do this in testing something (comparison of iscsi targets performance and reliability, i.e. trying to break iscsi targets).. Here's what I did on Ubuntu 8.04:

* Install Ubuntu, just a normal setup. Personally I do the bare minimum unless more is needed (less patching, less surface for attack, etc.)
* Update all..
* sudo apt-get install iscsitarget - Install the iSCSI Target
* sudo vi /etc/ietf.conf - Configuration file customizations

# Configure your Target name - this is iqn.YYYY-MM.com.example:anyname.you.want
# the YYYY-MM is the year and month your domain name was registered (this is a globally unique id, it's possible a domain name could be sold later and the name not be distinct with a new owner, hence this logic).
# Modify the LUN lines to have the path you want to export, i.e. if you want to export the entire /dev/sdb then the line would be Lun 0 Path=/dev/sdb,Type=fileio

* Consider security restrictions, in this file, firewall, etc.
* Restart iscsitarget for changes to take effect
* "invoke-rc.d iscsitarget restart"


Using Spare Files instead of actual hard disks

While you're testing you may want to consider using sparse files (i.e. files that claim to be a large size, but in reality on disk they are just stored using the real amount of data they hold.

For example lets take a 100 gb drive and create 4x 200gb partitions for iSCSI sharing:

root@ibmx1:/tmp# dd if=/dev/zero of=templun3 count=0 obs=1 seek=200G
0+0 records in
0+0 records out
0 bytes (0 B) copied, 4.1537e-05 s, 0.0 kB/s
root@ibmx1:/tmp# ls -al *lun3*
-rw-r--r-- 1 root root 214748364800 2008-05-03 04:43 templun3



You'll see the file reports being 200 gb, howeer dd wrote 0kB.

You can now export this as an iscsi target:

Target iqn.1995-10.com.example:iscsi.yourid
Lun 0 Path=/tmp/templun3,Type=fileio
回覆文章

回到「Linux」