LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-10-2014, 06:42 AM   #1
dimitrisz
LQ Newbie
 
Registered: Oct 2014
Posts: 1

Rep: Reputation: 0
Targetcli on block device looses configuration after reboot (device already in use)


Hi everyone,
I’m Dimitris from Greece and this is my first question on the forum

We try to share LUNs from an FC SAN to clients (an esxi server) via iscsi using an linux server as ‘proxy’.
We can’t directly connect the esxi server to the SAN because our HBAs are all pci-x while the server is pci-e. The solution we try is using an older server as a middleman, seeing the SAN LUNs from its HBAs and sharing them through iscsi to the esxi server.

SAN storage –(FC mpath) - Centos7 older server – (iscsi) – esxi host

We’ve used mapper-multipath to connect to the SAN (everything works fine there) and see the disk as /dev/mapper/mpathb .

We use targetcli to share this disk as an iscsi target to the esxi machine.

Since the linux server is pretty old and extra latency will be introduced anyway from this solution, we want to use the middle server as little as possible so we add the whole /dev/mapper/mpathb as a block device on the targetcli without using LVM.

Everything works fine and we can see the iscsi target from any iscsi initiator. Top shows minimum burden on the linux server and speed and stability are satisfactory (at least for testing).
The problem occurs when formatting the disk (from the ‘client’) in any way and rebooting the linux server. Since it now sees the partitions created /dev/mapper/mpathb1-2-etc. targetcli fails with “device is already in use” and looses all configuration. Even if we try to restoreconfig it fails again with the same message until we clear all partitions from /dev/mapper/mpathb.

The disk /dev/mapper/mpathb is not mounted anywhere, is not part of a VG (LVM2 is not even installed) but shows up (it’s partitions as well when formatted by the client systems ) in fdisk –l.
What I’m missing I guess and can’t find info on howto is hide somehow the partitions of the device from the system so targetcli doesn’t faill on reboot. I’ve only found mentions that the host server should not mount or use in any way directly its iscsi target resources (which sounds logical) but no clue on how this can be done with a block device.

Any help/idea/info will be greatly appreciated
Thanks
Dimitris

Following are the error messages on reboot, the fdisk –l when the disk is formatted by a client machine and the targetcli configurations after and before the reboot.

[root@localhost ~]# cat /var/log/messages |grep target

Oct 9 05:32:37 localhost systemd: Starting Restore LIO kernel target configuration...
Oct 9 05:32:37 localhost target: Traceback (most recent call last):
Oct 9 05:32:37 localhost target: File "/usr/bin/targetctl", line 87, in <module>
Oct 9 05:32:37 localhost target: main()
Oct 9 05:32:37 localhost target: File "/usr/bin/targetctl", line 84, in main
Oct 9 05:32:37 localhost target: funcs[sys.argv[1]](savefile)
Oct 9 05:32:37 localhost target: File "/usr/bin/targetctl", line 47, in restore
Oct 9 05:32:37 localhost target: errors = RTSRoot().restore_from_file(restore_file=from_file)
Oct 9 05:32:37 localhost target: File "/usr/lib/python2.7/site-packages/rtslib/root.py", line 260, in restore_from_file
Oct 9 05:32:37 localhost target: abort_on_error=abort_on_error)
Oct 9 05:32:37 localhost target: File "/usr/lib/python2.7/site-packages/rtslib/root.py", line 196, in restore
Oct 9 05:32:37 localhost target: so_obj = so_cls(**kwargs)
Oct 9 05:32:37 localhost target: File "/usr/lib/python2.7/site-packages/rtslib/tcm.py", line 673, in __init__
Oct 9 05:32:37 localhost target: self._configure(dev, wwn, readonly, write_back)
Oct 9 05:32:37 localhost target: File "/usr/lib/python2.7/site-packages/rtslib/tcm.py", line 686, in _configure
Oct 9 05:32:37 localhost target: + "device %s is already in use." % dev)
Oct 9 05:32:37 localhost target: rtslib.utils.RTSLibError: Cannot configure StorageObject because device /dev/mapper/mpathb is already in use.
Oct 9 05:32:37 localhost systemd: target.service: main process exited, code=exited, status=1/FAILURE
Oct 9 05:32:37 localhost systemd: Failed to start Restore LIO kernel target configuration.
Oct 9 05:32:37 localhost systemd: Unit target.service entered failed state.
Oct 9 05:32:39 localhost systemd: Reached target Multi-User System.

[root@localhost ~]# fdisk -l |grep mpa
Disk /dev/mapper/mpathb: 220.1 GB, 220095578112 bytes, 429874176 sectors
/dev/mapper/mpathb1 2048 429871103 214934528 7 HPFS/NTFS/exFAT
Disk /dev/mapper/mpathb1: 220.1 GB, 220092956672 bytes, 429869056 sectors
/dev/mapper/mpathb1p1 ? 1936269394 3772285809 918008208 4f QNX4.x 3rd part
/dev/mapper/mpathb1p2 ? 1917848077 2462285169 272218546+ 73 Unknown
/dev/mapper/mpathb1p3 ? 1818575915 2362751050 272087568 2b Unknown

[root@localhost ~]# targetcli
targetcli shell version 2.1.fb34
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> ls
o- / .................................................................................................... ........... [...]
o- backstores .................................................................................................... [...]
| o- block ........................................................................................ [Storage Objects: 0]
| o- fileio ....................................................................................... [Storage Objects: 0]
| o- pscsi ........................................................................................ [Storage Objects: 0]
| o- ramdisk ...................................................................................... [Storage Objects: 0]
o- iscsi .................................................................................................. [Targets: 0]
o- loopback ............................................................................................... [Targets: 0]
/>

[root@localhost ~]# targetcli
targetcli shell version 2.1.fb34
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> ls
o- / .................................................................................................... ............ [...]
o- backstores .................................................................................................... . [...]
| o- block ......................................................................................... [Storage Objects: 1]
| | o- LUN1 ........................................................ [/dev/mapper/mpathb (205.0GiB) write-thru activated]
| o- fileio ........................................................................................ [Storage Objects: 0]
| o- pscsi ......................................................................................... [Storage Objects: 0]
| o- ramdisk ....................................................................................... [Storage Objects: 0]
o- iscsi ................................................................................................... [Targets: 1]
| o- iqn.2014-10.local.lab .................................................................................... [TPGs: 1]
| o- tpg1 ...................................................................................... [no-gen-acls, no-auth]
| o- acls ................................................................................................. [ACLs: 1]
| | o- iqn.1991-05.com.microsoft:zoupas-dim.pathe.in ............................................... [Mapped LUNs: 1]
| | o- mapped_lun0 ......................................................................... [lun0 block/LUN1 (rw)]
| o- luns ................................................................................................. [LUNs: 1]
| | o- lun0 ....................................................................... [block/LUN1 (/dev/mapper/mpathb)]
| o- portals ........................................................................................... [Portals: 1]
| o- 172.16.2.227:3260 ....................................................................................... [OK]
o- loopback ................................................................................................ [Targets: 0]
/>
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
targetcli - ... device is already in use nagileon Linux - General 5 04-21-2014 08:33 AM
mknod: does the creation of a block device write data into the device? stf92 Slackware 7 11-20-2013 11:54 AM
block device names change after reboot (sometimes^^) Orangutanklaus Linux - Hardware 2 01-19-2011 09:38 AM
block device file delet after reboot from /dev viral_Ahire Linux - Software 2 03-15-2008 08:43 AM
UL 1.0 GRUB: could not find device for /boot: not found or not a block device cma Linux - General 4 12-12-2005 03:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration