Setting Up tgtd As A SAN

From AN!Wiki
Jump to: navigation, search

 AN!Wiki :: How To :: Setting Up tgtd As A SAN

Template note icon.png
Note: This is far from a comprehensive tutorial.

Setting Up tgtd As A SAN

Note that this is hosted on a machine outside of the cluster with the IP address of 10.255.0.222 and is exporting a storage device found at /dev/mmcblk0. A proper SAN device should be used in production, of course.

On the SAN server:

yum install scsi-target-utils
vim /etc/tgt/conf.d/sanlock.conf
<target iqn.2012-10.ca.alteeve:an-cluster-01.sanlock01>
	direct-store /dev/mmcblk0
	vendor_id Alteeve
</target>
systemctl start tgtd.service
systemctl status tgtd.service
tgtd.service - tgtd iSCSI target daemon
	  Loaded: loaded (/usr/lib/systemd/system/tgtd.service; disabled)
	  Active: active (running) since Thu, 11 Oct 2012 17:22:20 -0400; 10min ago
	 Process: 13552 ExecStop=/usr/sbin/tgtadm --op delete --mode system (code=exited, status=0/SUCCESS)
	 Process: 13548 ExecStop=/usr/sbin/tgt-admin --update ALL -c /dev/null (code=exited, status=0/SUCCESS)
	 Process: 13546 ExecStop=/usr/sbin/tgtadm --op update --mode sys --name State -v offline (code=exited, status=0/SUCCESS)
	 Process: 13622 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready (code=exited, status=0/SUCCESS)
	 Process: 13589 ExecStartPost=/usr/sbin/tgt-admin -e -c $TGTD_CONFIG (code=exited, status=0/SUCCESS)
	 Process: 13587 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline (code=exited, status=0/SUCCESS)
	Main PID: 13586 (tgtd)
	  CGroup: name=systemd:/system/tgtd.service
		  └ 13586 /usr/sbin/tgtd -f

On the cluster nodes:

Make sure they can see the SAN;

iscsiadm -m discovery -t sendtargets -p 10.255.0.222
10.255.0.222:3260,1 iqn.2012-10.ca.alteeve:an-cluster-01.sanlock01

Then connect to the LUN;

iscsiadm --mode node --portal 10.255.0.222 --target iqn.2012-10.ca.alteeve:an-cluster-01.sanlock01 --login
Logging in to [iface: default, target: iqn.2012-10.ca.alteeve:an-cluster-01.sanlock01, portal: 10.255.0.222,3260] (multiple)
Login to [iface: default, target: iqn.2012-10.ca.alteeve:an-cluster-01.sanlock01, portal: 10.255.0.222,3260] successful.

Looks good. Confirm with fdisk;

fdisk -l
<snip>
Disk /dev/sdb: 125 MB, 125960192 bytes
4 heads, 61 sectors/track, 1008 cylinders, total 246016 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
 
Disk /dev/sdb doesn't contain a valid partition table

Done!

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Us: Alteeve's Niche! Support: Mailing List IRC: #clusterlabs on Freenode   © Alteeve's Niche! Inc. 1997-2019
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.
Personal tools
Namespaces

Variants
Actions
Navigation
projects
Toolbox