Linux - Server This forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a
virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month.
Click here for more info.
02-05-2015, 10:06 PM
#1
Member
Registered: Dec 2011
Location: Chandler, AZ
Posts: 286
Rep:
Difficulty setting up iscsi target
CentOS release 6.6 (Final)
[root@centos66 ~]# tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2015-01.com.foobar:target01
[root@centos66 ~]# tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/iscsi_lv/lun0_lv
tgtadm: invalid request
[root@centos66 ~]# tgtadm --lld iscsi --mode target --op show
Target 1: iqn.2015-01.com.foobar:target01
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
Account information:
ACL information:
02-06-2015, 08:21 AM
#2
Member
Registered: Dec 2011
Location: Chandler, AZ
Posts: 286
Original Poster
Rep:
Based on other reading, it may be that my kernel in CentOS 6.6 doesn't support iscsi target management, even though I installed the SW.
Does anyone know if it's possible to add the iscsi target management to the kernel, how it's done or which versions of CentOS support this feature?
02-07-2015, 06:58 AM
#3
Member
Registered: Mar 2008
Posts: 48
Rep:
http://opentodo.net/2012/10/setup-is...r-on-centos-6/
this problem has nothing to do we kernel. stay calm and read the above link.
and follow step by step procedure. and still if you face any problem reply back.
02-07-2015, 01:42 PM
#4
Member
Registered: Dec 2011
Location: Chandler, AZ
Posts: 286
Original Poster
Rep:
[root@centos66 ~]# yum install -y scsi-target-utils
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: linux.mirrors.es.net
* extras: centos.mirror.lstn.net
* updates: centos-distro.cavecreek.net
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 2.1 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package scsi-target-utils.x86_64 0:1.0.24-16.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================== ============
Package Arch Version Repository Size
==================================================================================================== ============
Installing:
scsi-target-utils x86_64 1.0.24-16.el6 base 176 k
Transaction Summary
==================================================================================================== ============
Install 1 Package(s)
Total download size: 176 k
Installed size: 459 k
Downloading Packages:
scsi-target-utils-1.0.24-16.el6.x86_64.rpm | 176 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : scsi-target-utils-1.0.24-16.el6.x86_64 1/1
Verifying : scsi-target-utils-1.0.24-16.el6.x86_64 1/1
Installed:
scsi-target-utils.x86_64 0:1.0.24-16.el6
Complete!
[root@centos66 ~]# lvscan
ACTIVE '/dev/iscsi_vg/main0_lv' [2.00 GiB] inherit
ACTIVE '/dev/iscsi_vg/temp0_lv' [4.00 GiB] inherit
ACTIVE '/dev/iscsi_vg/user0_lv' [10.00 GiB] inherit
ACTIVE '/dev/root_vg/swap_lv' [1.00 GiB] inherit
ACTIVE '/dev/root_vg/root_lv' [2.51 GiB] inherit
[root@centos66 ~]# cat /etc/tgt/targets.conf
default-driver iscsi
<target iqn.2015-01.com.usao:target01>
<backing-store /dev/iscsi_vg/main0_lv>
lun 1
</backing-store>
<backing-store /dev/iscsi_vg/temp0_lv>
lun 2
</backing-store>
<backing-store /dev/iscsi_vg/user0_lv>
lun 3
</backing-store>
</target>
[root@centos66 ~]# cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW,ESTABLISHED -m tcp -p tcp --sport 860 -j ACCEPT
-A INPUT -m state --state NEW,ESTABLISHED -m tcp -p tcp --dport 3260 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
[root@centos66 ~]# service tgtd start
[root@centos66 ~]# chkconfig tgtd on
[root@centos66 ~]# tgtadm --mode target --op show
[root@centos66 ~]#
Last edited by usao; 02-07-2015 at 01:43 PM .
02-10-2015, 11:54 AM
#5
Member
Registered: Dec 2011
Location: Chandler, AZ
Posts: 286
Original Poster
Rep:
Quote:
Originally Posted by
manoj_hanse
Hello? I did as you requested. Can you review and advise?
02-11-2015, 01:42 AM
#6
Member
Registered: Mar 2008
Posts: 48
Rep:
well Done.
You did the server part.
Now you have to access the Luns / target from iscsi client.
install iscsi-initiator-utils on client.
Aceesing iscsi target from client:
1. add the iqn name to the file /etc/iscsi/initiatorname.iscsi file:
iqn.2015-01.com.usao:target01
2. enable the iscsi service to start on boot using chkconfig or systemctl
3. start the iscsi service using service or systemctl command. Check if the service is running.
4. command 1: (on client): iscsiadm -m discovery -t st -p ip-address-of-server
5. you should get some output: namely the iqn name of server (e.g. iqn.2015-01.com.example.com:server1)
6. now use this command: (on client) iscsiadm -m node -T server-iqn-name-from previous-output -p server-address -l
7. if you dont get upto here you will have to add some new -lines to the target.conf file on server.
namely: initiator-address client-ip-address after the Lun #.
02-11-2015, 08:59 AM
#7
Member
Registered: Dec 2011
Location: Chandler, AZ
Posts: 286
Original Poster
Rep:
AFAIK there is no point proceeding, since the target failed to create. The 'tgtadm --mode target --op show' command didn't show anything.
Using the initial commands, I could at least get a target created, but couldn't get the lun to add to the target.
02-11-2015, 11:30 PM
#8
Member
Registered: Mar 2008
Posts: 48
Rep:
Hi Usao,
Till now i was thinking that 6.6 is compatible with 6 but i guess its not. it is compatible with centos 7 and rhel 7.
So the commands has changed a little bit. tgtadm may not work on 6.6.
use targetcli when creating Luns.
install targetcli: yum install targetcli
and then follow these steps.:
http://www.ksovi.eu/2014/09/red-hat-...-with-lio.html
If even this doesn't work, then you can stop trying and there's no point in going ahead.
or use this link :
www.youtube.com/watch?v=Y0WgvdeNAuA
I could myself write the steps, but if already written then we can use them. Believe me its much much easy than in 6.
Thanks bye. have a nice day.
All times are GMT -5. The time now is 04:13 AM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News