john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Linux iscsi mount

linux-iscsi

sudo apt-get update sudo apt-get install open-iscsi open-iscsi-utils

iSCSI ports = typically TCP port 3260 (sometimes 860) (iana also reports udp?)

nano /etc/iscsi/iscsid.conf

depends on how you have it configured

node.session.auth.username = USER

node.session.auth.password = PASS

discovery.sendtargets.auth.username = USER

discovery.sendtargets.auth.password = PASS


/sbin/iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 --dport 3260 -m state --state NEW,ESTABLISHED -j ACCEPT /sbin/iptables -A OUTPUT -p tcp -s 0/0 --sport 3260 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT /sbin/iptables -A OUTPUT -p tcp --dport 3260 -m state --state NEW,ESTABLISHED -j ACCEPT /sbin/iptables -A INPUT -p tcp -s 0/0 --sport 3260 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

iscsiadm -m discovery -t sendtargets -p 10.10.10.181 10.10.10.181:3260,1 iqn.2006-01.com.openfiler:tsn.862427e16499

iscsiadm: connection to discovery address 10.10.10.181 failed (check your firewalls! if using openfiler ensure you've allowed network access)

sudo iscsiadm --mode node --targetname iqn.2006-01.com.openfiler:tsn.862427e16499 --portal 10.10.10.181:3260 --login

Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.862427e16499, portal: 10.10.10.181,3260] Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.862427e16499, portal: 10.10.10.181,3260]: successful


tail /var/log/messages

Jun 15 23:46:08 ubu10lts kernel: [596886.160801] scsi3 : iSCSI Initiator over TCP/IP Jun 15 23:46:08 ubu10lts kernel: [596886.577382] scsi 3:0:0:0: Direct-Access OPNFILER VIRTUAL-DISK 0 PQ: 0 ANSI: 4 Jun 15 23:46:08 ubu10lts kernel: [596886.664455] sd 3:0:0:0: Attached scsi generic sg2 type 0 Jun 15 23:46:08 ubu10lts kernel: [596886.688724] sd 3:0:0:0: [sdb] 16711680 512-byte logical blocks: (8.55 GB/7.96 GiB) Jun 15 23:46:08 ubu10lts kernel: [596886.688952] sd 3:0:0:0: [sdb] Write Protect is off Jun 15 23:46:08 ubu10lts kernel: [596886.689402] sd 3:0:0:0: [sdb] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA Jun 15 23:46:08 ubu10lts kernel: [596886.696972] sdb: unknown partition table Jun 15 23:46:09 ubu10lts kernel: [596886.784443] sd 3:0:0:0: [sdb] Attached SCSI disk


sudo fdisk /dev/sdb

m (help) p (print)

n = new partition p = primary partition 1 = partition number 1 first cylinder and last cylinder defaults (uses the full space)

w (write changes and quit)

sudo mkfs.ext3 /dev/sdb1 sudo mount /dev/sdb1 /mnt/iscsi-storage


dd if=/dev/zero of=output.img bs=8k count=256k

(takes a long time!) 262144+0 records in 262144+0 records out 2147483648 bytes (2.1 GB) copied, 25.57 s, 84.0 MB/s

262144+0 records in 262144+0 records out 2147483648 bytes (2.1 GB) copied, 399.447 s, 5.4 MB/s


sudo iscsiadm --mode node --targetname iqn.2006-01.com.openfiler:tsn.862427e16499 --portal 10.10.10.181:3260 --logout

update-rc.d -f ISCSI-TARGET.sh remove update-rc.d ISCSI-TARGET.sh defaults 99 (set it to run last, AFTER firewall rules and drivers are loaded!)

ISCSI-TARGET.SH

/bin/bash

/sbin/iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 --dport 3260 -m state --state NEW,ESTABLISHED -j ACCEPT /sbin/iptables -A OUTPUT -p tcp -s 0/0 --sport 3260 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT /sbin/iptables -A OUTPUT -p tcp --dport 3260 -m state --state NEW,ESTABLISHED -j ACCEPT /sbin/iptables -A INPUT -p tcp -s 0/0 --sport 3260 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

iscsiadm -m discovery -t sendtargets -p 10.10.10.181 sudo iscsiadm --mode node --targetname iqn.2006-01.com.openfiler:tsn.862427e16499 --portal 10.10.10.181:3260 --login

mount /dev/sdc1 /storage/target/


  • « notepad javascript in url
  • Iscsi mount on boot start up script »

Published

Jun 17, 2011

Category

linux

~462 words

Tags

  • iscsi 5
  • linux 249
  • mount 7