Linux stuff

Post pics

Posts

iSCSI protocol, how to use in Linux environment using simple DD created images.

On 18/03/2013, in Linux stuff, by admin

First of all, iSCSI protocol cannot run in NATed environment, due to protocol implementation which makes the LUN scan over different TCP session, and ports which are used there are not trivial… So will work only in LAN, or WAN.

iSCSI target for Linux – sources for compiling.

iSCSI initiator exists on following linux OS installations, windows is not supported:

RHEL – 5.6/7 6.0 and 6.1
iSCSI consists of server and client sides. iSCSI target is installed on the server side and iSCSI initiator is used on the client.

iSCSI target installation process:

tar xvfz iscsitarget-1.4.20.2.tar.gz
cd iscsitarget-1.4.20.2
make && make install
iSCSI target configuration process:

vi /etc/iet/ietd.conf (Add the following line – we are going to use images created by using the dd utility, see the example for creating the image files below (delete everything else there)
Target iqn.2001-04.com.example:storage.lun1
IncomingUser iscsi Password1
OutgoingUser iscsi Password1
Lun 0 Path=/media/sdb1/storage/lun1.img,Type=fileio
Alias iscsi0
:wq
cd /media/sdb1/storage/
dd if=/dev/zero of=lun1.img bs=1024k count=10000 (the following line would create an image of 10GB size)
note the above configuration of /etc/iet/ietd.conf should point to correct path of the image file
restart the “/etc/init.d/iscsi-target restart” to load the new configuration
iSCSI initiator configuration process: (note the IP address is the IP address of the iSCSI target server, the following commands are automatically added to the iSCSI initiator configuration:
iscsiadm -m discovery -t st -p 10.76.5.125
iscsiadm -m node
iscsiadm -m node –targetname “iqn.2001-04.com.example:storage.lun1” –portal “10.76.5.125:3260” –op=update –name node.session.auth.authmethod –value=CHAP
iscsiadm -m node –targetname “iqn.2001-04.com.example:storage.lun1” –portal “10.76.5.125:3260” –op=update –name node.session.auth.username –value=iscsi
iscsiadm -m node –targetname “iqn.2001-04.com.example:storage.lun1” –portal “10.76.5.125:3260” –op=update –name node.session.auth.password –value=Password1
iscsiadm -m node –targetname “iqn.2001-04.com.example:storage.lun1” –portal “10.76.5.125:3260” –login
vi /etc/iscsi/iscsid.conf and verify the following line exist: node.startup = automatic
Verify with fdisk -l that the new device name is added correctly
Now you can process to formatting and partitioning

Bash scripting – I think I earned 5 stars… Well, 4.5.

On 25/01/2011, in Entries in English, Linux stuff, by admin

if [ -e $compare_table_file ]; then
        echo “Compare table found, comparing results”
        ### TODO, create two dimensional array from report and static table”
        ### Compare the tables
        threshold=5 ### if more than 5% less than const, the test would FAIL
        frames_tested=( `cat $report_name | grep -A 50 “Throughput and Latency results” | grep -A 30 “Frame” | grep -G “[0-9]”| grep -v “Run” | awk {‘print $1″ “$3’}` )
        frames_compared_to=( `cat $compare_table_file | sed ‘s/\”//’ | grep -A 30 “Frame” | grep -G “[0-9]”| grep -v “Run” | awk {‘print $1″ “$3’}` )

        let test_frames_tested=${#frames_tested[*]}/2
        let test_frames_comprated=${#frames_compared_to[*]}/2

        if [ $test_frames_tested -eq 1 ]; then
                echo “wrong count of frames and results”
                reportSuccess=”FAIL”
                return
        fi

        if [ $test_frames_comprated -eq 1 ]; then
                echo “wrong count of frames and consts”
                reportSuccess=”FAIL”
                return
        fi

        ## Ugly solution to solve the bad output

        let runtime1=${#frames_tested[*]}-1
        let runtime2=${#frames_compared_to[*]}-1

        echo -e “====\t ==========\t ========\t ========”
        echo -e “Size\t Throughput\t Constant\t Variance”
        echo -e “====\t ==========\t ========\t ========”
        #for i in `seq 0 2 ${#frames_tested[*]}`; do
        for i in `seq 0 2 $runtime1`; do
        #for b in `seq 0 2 ${#frames_compared_to[*]}`; do
                for b in `seq 0 2 $runtime2`; do
                if [ “${frames_tested[$i]}” == “${frames_compared_to[$b]}” ]; then
                calc=$(echo “scale=2; -1 * (100 – (100 * ${frames_tested[$i+1]} / ${frames_compared_to[$b+1]}))” | bc)
                rounded=$(echo “scale=0; -1 * (100 – (100 * ${frames_tested[$i+1]} / ${frames_compared_to[$b+1]}))” | bc)
                echo -e “${frames_tested[$i]}\t ${frames_tested[$i+1]}%\t ${frames_compared_to[$b+1]}%\t $calc%”
                        abs_rounded=${rounded#-}
                        if [ $abs_rounded -le $threshold ]; then
                                reportSuccess=”SUCCESS”
                        else
                                reportSuccess=”FAIL”
                                fail=1
                        fi
                fi
                done
        done

        if [ “$fail” == “1” ]; then
                reportSuccess=”FAIL”
        else
                reportSuccess=”SUCCESS”
        fi
else
        return
fi

Automated blogs, direct linking etc’…

On 28/12/2010, in General News, Linux stuff, by admin

Unfortunately, I had to block access to /music 🙁 People started to share links and various music sites checking the availability of my music online started to play it automatically without even knowing it… So currently I have user and password there, just to stop these idiots. If you need password and username just message me or send me an email.

It’s daniel\ at\ dmelody\ \com