2

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

3 Answers 3

2

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

0
0

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

0

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .