Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

# tgtadm --lld iscsi --op delete --mode target --tid=X

share|improve this answer
    
Thanks, I am aware of this :) –  dyasny Apr 20 '10 at 10:18
up vote 0 down vote accepted

Guess I'm going to have to stick to openfiler for now... not my first choice, but storage manageability is more important

share|improve this answer

Umh, use targets.conf and tgt-admin (http://wpkg.org/TGT-admin). Don't need to restart the service ?

share|improve this answer
    
Yeah, I'm getting better at this :) –  dyasny Jun 2 '10 at 6:31
    
So does this answer you initial question? If so, please mark it so :) –  tore- Jun 2 '10 at 10:12
    
I ended up using openfiler, and will probably get a proper iscsi SAN soon-ish –  dyasny Jul 9 '10 at 10:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.