Iscsi - target and initiator setup debian: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Category:Linux == iSCSI - target (server) setup == We'll use tgt to handle everything dynamically == iSCSI - initiator (client) setup == Link to page: <pre> http://isc...") |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
http://iscsitargetandinitiator.blogspot.dk/ |
http://iscsitargetandinitiator.blogspot.dk/ |
||
</pre> |
</pre> |
||
== Show target devices and initiators connected == |
|||
<pre> |
|||
tgtadm --lld iscsi --op show --mode target |
|||
</pre> |
|||
== Add devices/disks/partitions to target == |
|||
<pre> |
|||
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb |
|||
</pre> |
|||
== Re-adding LVM based iscsi disks after reboot == |
|||
Requires a change in how LVM 'attaches' to disks. |
|||
So if you've added say /dev/sdb to be a complete iscsi device and on the initiator using it as a LVM, it does not attach itself to the target on reboot. |
|||
Edit /etc/lvm/lvm.conf and change: |
|||
<pre> |
|||
# By default we accept every block device: |
|||
#filter = [ "a/.*/" ] |
|||
# Every block device except /dev/sdb, that is. |
|||
filter = [ "r|/dev/sdb|" ] |
|||
</pre> |
|||
More info here: http://www.sysarchitects.com/iscsi_target_on_rhel6 |
|||
On debian I couldn't get this to work; I found a simple init-script from RH bugzillatracker which did the trick: |
|||
<pre> |
|||
#!/bin/sh |
|||
### BEGIN INIT INFO |
|||
# Provides: tgtd |
|||
# Required-Start: $network $syslog |
|||
# Required-Stop: $network $syslog |
|||
# Default-Start: 2 3 4 5 |
|||
# Default-Stop: |
|||
# Short-Description: Start the iSCSI target server tgt |
|||
# Description: iSCSI target server tgt (http://stgt.sf.net) |
|||
### END INIT INFO |
|||
set -e |
|||
TGTD="/usr/sbin/tgtd" |
|||
TGTADMIN="/usr/sbin/tgt-admin" |
|||
DEFAULTS="/etc/default/tgt" |
|||
# Check for daemon presence |
|||
[ -x "$TGTD" ] || exit 0 |
|||
OPTIONS="" |
|||
MODULES="" |
|||
# Include tgtd defaults if available |
|||
[ -r "$DEFAULTS" ] && . "$DEFAULTS" |
|||
# Get lsb functions |
|||
. /lib/lsb/init-functions |
|||
case "$1" in |
|||
start) |
|||
log_begin_msg "Starting iSCSI target (tgt) services..." |
|||
start-stop-daemon --start --quiet --oknodo --exec "$TGTD" -- $OPTIONS |
|||
[ -x "$TGTADMIN" ] && $TGTADMIN -e |
|||
log_end_msg $? |
|||
;; |
|||
stop) |
|||
log_begin_msg "Stopping iSCSI target (tgt) services..." |
|||
start-stop-daemon --stop --quiet --oknodo --retry 2 --exec "$TGTD" |
|||
log_end_msg $? |
|||
;; |
|||
restart) |
|||
$0 stop |
|||
sleep 1 |
|||
$0 start |
|||
;; |
|||
reload|force-reload) |
|||
log_begin_msg "Reloading iSCSI target (tgt) services..." |
|||
start-stop-daemon --stop --signal 1 --exec "$TGTD" |
|||
log_end_msg $? |
|||
;; |
|||
status) |
|||
status_of_proc "$TGTD" tgtd |
|||
;; |
|||
*) |
|||
log_success_msg "Usage: /etc/init.d/tgt {start|stop|restart|reload|force-reload|status}" |
|||
exit 1 |
|||
esac |
|||
</pre> |
|||
== Generating config file of disks/partitions == |
|||
<pre> |
|||
tgt-admin -dump > /etc/tgt/targets.conf |
|||
</pre> |
|||
== iSCSI with HA == |
|||
Attached pdf document which describes DRBD, Pacemaker and iSCSI setup: |
|||
[[File:ha-iscsi.pdf]] |
|||
== iSCSI Linux links == |
|||
[http://www.zoobey.com/index.php/resources/all-articles-list/451-linux-tgtadm-setup-iscsi-target--san- Good tgt-based setup] |
|||
[http://www.sysarchitects.com/iscsi_target_on_rhel6 Howto add UDEV rules for exposed disks] |
|||
[http://www.howtoforge.com/using-iscsi-on-debian-squeeze-initiator-and-target Simple howto with debian initiator and target] |
|||
[http://wiki.debian.org/SAN/iSCSI/open-iscsi initiator non-tgt setup] |
|||
[http://www.cyberciti.biz/faq/howto-setup-debian-ubuntu-linux-iscsi-initiator/ Simple setup] |
|||
[http://www.howtoforge.com/using-iscsi-on-debian-lenny-initiator-and-target open open-iscsi] |
Latest revision as of 12:07, 30 November 2012
iSCSI - target (server) setup
We'll use tgt to handle everything dynamically
iSCSI - initiator (client) setup
Link to page:
http://iscsitargetandinitiator.blogspot.dk/
Show target devices and initiators connected
tgtadm --lld iscsi --op show --mode target
Add devices/disks/partitions to target
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb
Re-adding LVM based iscsi disks after reboot
Requires a change in how LVM 'attaches' to disks.
So if you've added say /dev/sdb to be a complete iscsi device and on the initiator using it as a LVM, it does not attach itself to the target on reboot.
Edit /etc/lvm/lvm.conf and change:
# By default we accept every block device: #filter = [ "a/.*/" ] # Every block device except /dev/sdb, that is. filter = [ "r|/dev/sdb|" ]
More info here: http://www.sysarchitects.com/iscsi_target_on_rhel6
On debian I couldn't get this to work; I found a simple init-script from RH bugzillatracker which did the trick:
#!/bin/sh ### BEGIN INIT INFO # Provides: tgtd # Required-Start: $network $syslog # Required-Stop: $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Start the iSCSI target server tgt # Description: iSCSI target server tgt (http://stgt.sf.net) ### END INIT INFO set -e TGTD="/usr/sbin/tgtd" TGTADMIN="/usr/sbin/tgt-admin" DEFAULTS="/etc/default/tgt" # Check for daemon presence [ -x "$TGTD" ] || exit 0 OPTIONS="" MODULES="" # Include tgtd defaults if available [ -r "$DEFAULTS" ] && . "$DEFAULTS" # Get lsb functions . /lib/lsb/init-functions case "$1" in start) log_begin_msg "Starting iSCSI target (tgt) services..." start-stop-daemon --start --quiet --oknodo --exec "$TGTD" -- $OPTIONS [ -x "$TGTADMIN" ] && $TGTADMIN -e log_end_msg $? ;; stop) log_begin_msg "Stopping iSCSI target (tgt) services..." start-stop-daemon --stop --quiet --oknodo --retry 2 --exec "$TGTD" log_end_msg $? ;; restart) $0 stop sleep 1 $0 start ;; reload|force-reload) log_begin_msg "Reloading iSCSI target (tgt) services..." start-stop-daemon --stop --signal 1 --exec "$TGTD" log_end_msg $? ;; status) status_of_proc "$TGTD" tgtd ;; *) log_success_msg "Usage: /etc/init.d/tgt {start|stop|restart|reload|force-reload|status}" exit 1 esac
Generating config file of disks/partitions
tgt-admin -dump > /etc/tgt/targets.conf
iSCSI with HA
Attached pdf document which describes DRBD, Pacemaker and iSCSI setup:
iSCSI Linux links
Howto add UDEV rules for exposed disks