FreeBSD iSCSI
Sissejuhatus
iSCSI tehnoloogia võimaldab üle TCP/IP võrgu ühendada klientarvutile külge plokk-seadme vastavat teenust pakkuvast serverist, kusjuures on kombeks kasutada selliseid nimetusi kliendi ja serveri kohta
initiator - iSCSI klient target - iSCSI server
Target ja initiator arvutid võivad kasutada erinevaid operatsioonisüsteeme ning asuda ka erinevatel riistvaralistel platvormidel. Kuna andmevahetuse maht võib kujuneda suureks, siis võib olla mõistlik lisaks kasutusele võtta ainult iSCSI jaoks eraldatud võrgusegment. Tundub, et initiatori osas on suurem arendajate tähelepanu koondunud projektile [1] ning targeti osas projektile [2].
Serveri install
# cd /usr/ports/net/iscsi-target/ # make install ===> Installing rc.d startup script(s) ===> Compressing manual pages for iscsi-target-20080207_2 ===> Registering installation for iscsi-target-20080207_2 ===> SECURITY REPORT: This port has installed the following files which may act as network servers and may therefore pose a remote security risk to the system. /usr/local/bin/iscsi-target This port has installed the following startup scripts which may cause these network services to be started at boot time. /usr/local/etc/rc.d/iscsi_target If there are vulnerabilities in these programs there may be a security risk to the system. FreeBSD makes no guarantee about the security of ports included in the Ports Collection. Please type 'make deinstall' to deinstall the port if this is a concern. For more information, and contact details about the security status of this software, see the following webpage: http://www.netbsd.org/
Avame /etc/rc.conf ja lisame
iscsi_target_enable="YES"
et reboodil automaatselt server starditaks
Seejärel jagame välja ketta. Selleks on meil /dev/ad0 suurusega 70GB
# nano /usr/local/etc/iscsi/targets
# NAME DEVICE START LENGTH extent0 /dev/ad0 0 70GB # NAME ACCESS STORAGE NETMASK target0 rw extent0 193.40.0.0/24
Ja stardime serveri
# /usr/local/etc/rc.d/iscsi_target start Starting iscsi_target. Reading configuration from `/usr/local/etc/iscsi/targets' target0:rw:193.40.0.0/24 extent0:/dev/ad0:0:75161927680 DISK: 1 logical unit (146800640 blocks, 512 bytes/block), type iscsi fs DISK: LUN 0: 71680 MB disk storage for "target0" TARGET: TargetName is iqn.1994-04.org.netbsd.iscsi-target
Klient
# nano /etc/iscsi.conf
target0 { # nickname targetaddress = 193.40.0.194 targetname = iqn.1994-04.org.netbsd.iscsi-target:target0 }
Laadime iscsi mooduli
# kldload iscsi_initiator
Selleks ,et automaatselt moodul laaditaks lisame
# nano /etc/rc.conf
iscsi_initiator_load="YES"
Ning haagime ketta külge
# iscontrol -n target0 # iscontrol[1464]: running iscontrol[1464]: (pass1:iscsi0:0:0:0): tagged openings now 0 iscontrol[1464]: cam_open_btl: no passthrough device found at 1:0:1 iscontrol[1464]: cam_open_btl: no passthrough device found at 1:0:2 iscontrol[1464]: cam_open_btl: no passthrough device found at 1:0:3 iscontrol: supervise starting main loop
dmesgi/message logi peaks ilmuma read
da1 at iscsi0 bus 0 target 0 lun 0 da1: <NetBSD NetBSD iSCSI 0> Fixed Direct Access SCSI-3 device
Kasutamine ja katsetamine
# newfs /dev/da1 /dev/da1: 71680.0MB (146800640 sectors) block size 16384, fragment size 2048 using 391 cylinder groups of 183.77MB, 11761 blks, 23552 inodes. super-block backups (for fsck -b #) at: 160, 376512, 752864, 1129216, 1505568, 1881920, 2258272, 2634624, 3010976, 3387328, 3763680, 4140032, 4516384, 4892736, 5269088, 5645440, 6021792, 6398144, 6774496, 7150848, 7527200, 7903552, 8279904, 8656256, 9032608, 9408960, 9785312, 10161664, 10538016, 10914368, 11290720, 11667072, 12043424, 12419776, 12796128, 13172480, 13548832, 13925184, 14301536, 14677888, 15054240, 15430592, 15806944, 16183296, 16559648, 16936000, 17312352, 17688704, 18065056 ...
# mount /dev/da1 /home/net/ # df Filesystem 1K-blocks Used Avail Capacity Mounted on ... /dev/da1 71085512 4 65398668 0% /usr/home/net
1.1giga kirjutuskiiruse test 100Mb võrgus
# dd if=/dev/zero of=zero-file bs=1024 count=1048576 1048576+0 records in 1048576+0 records out 1073741824 bytes transferred in 117.719325 secs (9121203 bytes/sec)