iscsi-client.rcS revision 1942:b29baae4086b
1#!/bin/sh
2#
3# /etc/init.d/rcS
4#
5
6echo -n "mounting swap..."
7/sbin/swapon /dev/hdc
8echo "done."
9
10echo -n "setting up network..."
11/sbin/ifconfig lo 127.0.0.1
12/sbin/ifconfig eth0 192.168.0.10 txqueuelen 1000
13
14echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle
15echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
16echo "1" > /proc/sys/net/ipv4/tcp_window_scaling
17echo "0" > /proc/sys/net/ipv4/tcp_timestamps
18echo "0" > /proc/sys/net/ipv4/tcp_sack
19echo "15" > /proc/sys/net/ipv4/tcp_fin_timeout
20echo "16384" > /proc/sys/net/ipv4/tcp_max_syn_backlog
21echo "262144" > /proc/sys/net/ipv4/ip_conntrack_max
22echo "1024 65535" > /proc/sys/net/ipv4/ip_local_port_range
23echo "10000000 10000000 10000000" > /proc/sys/net/ipv4/tcp_rmem
24echo "10000000 10000000 10000000" > /proc/sys/net/ipv4/tcp_wmem
25echo "10000000 10000000 10000000" > /proc/sys/net/ipv4/tcp_mem
26#echo "262144" > /proc/sys/net/ipv4/ip_conntrack_max
27echo "524287" > /proc/sys/net/core/rmem_max
28echo "524287" > /proc/sys/net/core/wmem_max
29echo "524287" > /proc/sys/net/core/optmem_max
30echo "300000" > /proc/sys/net/core/netdev_max_backlog
31echo "131072" > /proc/sys/fs/file-max
32echo "10" > /proc/sys/vm/dirty_writeback_centisecs
33echo "done."
34
35cat > /etc/initiatorname.iscsi <<EOF
36InitiatorName=iqn.1987-05.10.0.168.192
37EOF
38
39cat > /etc/iscsid.conf <<EOF
40node.active_cnx = 1
41node.startup = manual
42#node.session.auth.username = dima
43#node.session.auth.password = aloha
44node.session.timeo.replacement_timeout = 0
45node.session.err_timeo.abort_timeout = 10
46node.session.err_timeo.reset_timeout = 30
47node.session.iscsi.InitialR2T = No
48node.session.iscsi.ImmediateData = Yes
49node.session.iscsi.FirstBurstLength = 262144
50node.session.iscsi.MaxBurstLength = 16776192
51node.session.iscsi.DefaultTime2Wait = 0
52node.session.iscsi.DefaultTime2Retain = 0
53node.session.iscsi.MaxConnections = 0
54node.cnx[0].iscsi.HeaderDigest = None
55node.cnx[0].iscsi.DataDigest = None
56node.cnx[0].iscsi.MaxRecvDataSegmentLength = 65536
57#discovery.sendtargets.auth.authmethod = CHAP
58#discovery.sendtargets.auth.username = dima
59#discovery.sendtargets.auth.password = aloha
60EOF
61
62mount -t sysfs none /sys
63
64echo "" > /var/log/iscsi.log
65chmod 0600 /var/log/iscsi.log
66chmod 0666 -R /var/db/iscsi
67
68# Required for udev to activate/deactivate devices.
69echo "/sbin/hotplug" > /proc/sys/kernel/hotplug	
70
71/sbin/insmod /modules/scsi_transport_iscsi.ko
72/sbin/insmod /modules/iscsi_tcp.ko
73
74# Create /dev/iscsictl
75if [ ! -f /dev/iscsictl ]; then
76    while read major device
77    do
78    if [ "$device" == "iscsictl" ]; then
79        mknod /dev/$device c $major 0
80    fi
81    done < /proc/devices
82fi
83
84echo -n "Starting iscsid..."
85/iscsi/iscsid -f &
86
87echo -n "Waiting for server..."
88/usr/bin/netcat -c -l -p 8000 
89
90echo -n "Attaching target..."
91/iscsi/iscsiadm -m discovery -t st -p 192.168.0.1
92/iscsi/iscsiadm -m node -r a0c049 --login
93echo "done."
94
95sleep 5
96
97echo -n "Starting aio benchmark..."
98/benchmarks/aio_bench/aio-bench -n 8 -s 8 -r .666 -c 8 -i 4000 -C 500 /dev/sda
99# very unstable /benchmarks/aio_bench/aio-bench -n 8 -s 5120 -r .666 -c 20 -i 3000 /dev/sda
100# very unstable /benchmarks/aio_bench/aio-bench -n 8 -s 8 -r 0 -c 20 -i 3000 /dev/sda
101# stable 960 Mbps /benchmarks/aio_bench/aio-bench -n 8 -s 8 -r 1 -c 20 -i 3000 /dev/sda
102# very unstable /benchmarks/aio_bench/aio-bench -n 8 -s 1024 -r 1 -c 20 -i 3000 /dev/sda
103# stable ~1.5 Gbps /benchmarks/aio_bench/aio-bench -n 16 -s 32 -r 1 -c 50 -i 3000 /dev/sda
104# stable ~1.5 Gbps /benchmarks/aio_bench/aio-bench -n 50 -s 32 -r 1 -c 50 -i 3000 /dev/sda
105
106echo "starting bash shell..."
107/bin/bash
108
109echo -n "halting machine"
110m5 exit
111