Wiki Blog/2008-02-07Usage of open-iscsi on LinuxSetting up a iSCSI target ("server") on linux with the daemon "ietd" is quite simple:
Target iqn.2007-01.com.mydomain:mymachine.storage
Lun 0 Path=/dev/sda,Type=fileio,IOMode=ro
However acting as a iSCSI initiator ("client") on linux is a bit mor complicated, thanks to the non-existence of straight-forward documentation about "iscsiadm". Still, I managed to figure out (with a little help from a Install open-iscsiapt-get install open-iscsi Discover your iSCSI targetsType the following (on a single line, or through cut and paste): iscsiadm \ --mode discovery \ --type sendtargets \ --portal my_iSCSI_target_machine This will give you something like this: my_iSCSI_target_machine:3260,1 iqn.2007-01.com.mydomain:mymachine.storage Login to a targetNow run this (again on a single line, or through cut and paste): iscsiadm \ --mode node \ --targetname iqn.2007-01.com.mydomain:mymachine.storage \ --portal my_iSCSI_target_machine \ --login This will have added a new SCSI device. To find out which, run this: dmesg | tail Which results on my system in this: sd 1:0:0:0: ?[sdb] 4782905 512-byte hardware sectors (2449 MB) sd 1:0:0:0: ?[sdb] Write Protect is off sd 1:0:0:0: ?[sdb] Mode Sense: 77 00 00 08 sd 1:0:0:0: ?[sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA sd 1:0:0:0: ?[sdb] 4782905 512-byte hardware sectors (2449 MB) sd 1:0:0:0: ?[sdb] Write Protect is off sd 1:0:0:0: ?[sdb] Mode Sense: 77 00 00 08 sd 1:0:0:0: ?[sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA sdb: sdb1 < sdb5 > sd 1:0:0:0: ?[sdb] Attached SCSI disk This means that my new device is called "/dev/sdb". Let's mount the first partition! mkdir /storage mount /dev/sdb1 /storage © Copyright 2004 - 2006 Nicola Fankhauser. All Rights Reserved. |