Managing a test iSCSI target server
Posted
by dyasny
on Server Fault
See other posts from Server Fault
or by dyasny
Published on 2010-02-11T14:11:54Z
Indexed on
2010/04/19
19:13 UTC
Read the original article
Hit count: 473
Hi all,
I am using a RHEL server with a few hard drives, and tgtd as the iscsi target software. I a looking for a way to allocate and deallocate space and targets with that space, without restarting my system, or harming other LUNs.
Currently, all my HDDs are PVs in a single VG, and I lvcreate/lvremove as required, and then export the allocated LVs using a tgt script:
usr/sbin/tgtadm --lld iscsi --op new --mode target --tid=1 --targetname iqn.2001-04.com.lab.gss:300gb
/usr/sbin/tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/mapper/iscsi_vg-iscsi_300Gb
/usr/sbin/tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
/usr/sbin/tgtadm --lld iscsi --op new --mode target --tid=2 --targetname iqn.2001-04.com.lab.gss:200gb
/usr/sbin/tgtadm --lld iscsi --op new --mode logicalunit --tid 2 --lun 1 -b /dev/mapper/iscsi_vg-iscsi_200Gb
/usr/sbin/tgtadm --lld iscsi --op bind --mode target --tid 2 -I ALL
/usr/sbin/tgtadm --lld iscsi --op new --mode target --tid=3 --targetname iqn.2001-04.com.lab.gss:100gb
/usr/sbin/tgtadm --lld iscsi --op new --mode logicalunit --tid 3 --lun 1 -b /dev/mapper/iscsi_vg-iscsi_100Gb
/usr/sbin/tgtadm --lld iscsi --op bind --mode target --tid 3 -I ALL
tgtadm --mode target --op show
So in order to remove a LUN, I stop the tgtd service, lvremove the lv, and remove the entry from the iscsi target script
When I add a lun, I run lvcreate, and then add an entry to the script and run it.
This is not quite optimal, since restarting the service is a bad idea while other LUNs are busy, so I am looking for a more scalable and safer way.
Thanks
© Server Fault or respective owner