• m Linux pЉ|
    osGAзR firefox s
    | cD | ̔D | g | A | ~R | ୱR | w޲z | QAO | Ŏ | y`~ | m | Xs |
    @ @ @
    @
    ̪sG2011/08/02
    pGAtݭnjqϺЮeqAOoS NAS Υ~^xs]QAȦӤHqɡAMpOnH ɡAzL SCSI Ϻ (iSCSI) N^jjDUTIo iSCSI ONӦۺƼ[E SCSI ]QA ]iHiѦp LVM Τ譱@AӤOx¨ϥΦAݴѪɮרtӤwASDUI

    18.1 ɮרtROϺ
    @@18.1.1 NAS P SAN
    @@18.1.2 iSCSI
    @@18.1.3 U}
    18.2 iSCSI target ]w
    @@18.2.1 һݳnPnc
    @@18.2.2 target ڳ]w
    18.3 iSCSI initiator ]w
    @@18.3.1 һݳnPnc
    @@18.3.2 initiator ڳ]w
    @@18.3.3 @Ӵd
    18.4 I^U
    18.5 زD
    18.6 ѦҸƻP\Ū
    18.7 w糧媺ijGhttp://phorum.vbird.org/viewtopic.php?f=16&t=35503

    jADϥ18.1 ɮרtROϺ

    Atq`Oݭnxs]QAxs]QFiHϥΨtتϺФ~ApGتϺЮeq^jA ӥB]SB~ϺеA (SATA IDE) iήɡA`M״NOW[ NAS ([xsA) Υ~^xs]QCA@ɤ@ItAiN|Ψ SAN (xsk) o@QN (1)C

    LAAO@R[cA򥻤WA̪wгq`OHϺа}C (RAID) @䪺CϺа}Cڭ̦bgĤTĤQ͹LFAo̴NAoCo̷QnAOAO NAS SO SAN H o̦󤣦PHPإDD} iSCSI SOԣOHUNڭ̨ӽͤ@͡C


    pADϥ18.1.1 NAS P SAN

    ѩ~ƶqVӶVjAӥBnʻPOKʶVӶV@AרƮweA``eqxOH TB (1TB = 1024GB) bip⪺CzIuiȡIҥHoAϺа}CRδNܭnFCϺа}Cq`Ob̩OH Ϻа}Cq`O (1)DEϺа}CdAiHۦ޲zϺа}CCLQnѺϺа}CeqA onzLB~AȤ~F (2)~^Ϻа}C]QANOxªϺа}C]QAzLYǤsDEWA DE]nwUASXʵ{A~஻oӳ]QҴѪϺЮeqC

    LAHثeT|ӻAARMܤo줺ةΥ~^ RAID FA``o쪺RMO NAS P SAN AoOԣNNH ڭ̔xӻG


    • NAS (Network Attached Storage, [xsA)

    򥻤WANAS NO@ȨƦnDEFAunN NAS s^WAbWLDEN^s NAS WYƤFC̔xANAS NO@ file server o㤣LANAS ѩ]O^bWAҥHApGWYӥΤjqs NAS WYƮɡAOܮeyyDAoӤꐷIC픪 NAS q`|ϥ Linux tftnϺа}CӴѤjeqɮרtCLįNݥ[jTI~ANAS ]q`䴩 TCP/IP A÷| NFS, SAMBA, FTP α`qTwӴѥΤݨoɮרtC

    򤣭n^ϥέӤHqwU Linux Aft}AȡAYi NAS wpnѪjeqŶTIFݭn NAS OH ]Aq` NAS R|]AܦhœAAq`OQ Web ӱϺа}C]wpB IP ΨL}]wA HάO_ѬYǯSwAȆΆΡC]㦳˩Mާ@PAD IT HӻA޸eTC o]O NAS sbتC

    LAثeˬO FreeNAS n}oM (http://sourceforge.net/projects/freenas/, 2)AiHA Linux PC ܦ@izL Web ު NAS ILOتIAêBͥiHۦeUPwUMnӪ


    • SAN (Storage Area Networks, xsk)

    qWӬݡA NAS NO@iHѤjeqɮרtDEI ڭ̪DxDE^ѪAѦA򻡤]OI ҥHäLwAϺЦbP@DEWCOpGANOjqϺШϥΪݨDAMpOnH oɴNonϥΨ SAN oNTI

    ̔xݪkANON SAN @ӥ~^xs]QCuOxª~^xs]QȯzLYǤ (p SCSI eSATA) x@DEϥΡA SAN oiHzLYǯSγqDӴѰkҦEiϺЦsCn`NASAN OѡyϺ (block device)zDEΡAӤO^ NAS ѪOywɮרt (NFS, SMB...)zIo̪tjI]Aϥ SAN DE|hX@ӤjϺСAåiw SAN ѪϺжiλP榡Ɔΰʧ@CQQݡAA NAS Ѫɮרt榡ƶܡHaIoAt_H

    t~AJM SAN iHѺϺСA NAS hOѬ}ɮרtA NAS णzLhϥ SAN ҴѪϺЩOHSMOiH[I] SAN ̤jتNObѺϺеADEϥΡANAS ]O@㪺AA ҥH NAS SMiHϥ SAN TIPɨLA]^ϥγo SAN ӶiƦsC

    ~AJM SAN }oتOnѤjqϺеϥΪ̡AljKtSMOD`nC]A SAN jhtXֳqD (Fibre Channel) Ӵ@tƶljKCثeAǪֳqDOt׬O 2GB ARiF 10GB HWO㤣LAϥΥֆΧ޳N@]QASMNQ@ǡC

    AӺA[W޳NA{AӺC (dBBѾΆγ]Q) wgiHF GB tפFAm SAN ֳqDtרtwgYpܦhT㨺O_ڭ̥iHzLo GB AӺӳs^ SAN ]QOHoNOڭ^Uӭn쪺 iSCSI [cTI ^_^


    pADϥ18.1.2 iSCSI

    ~ϥΪAYjeqϺЪݨDɡAq`OzL SCSI Ӧ^ SCSI ϺСA]AWn[U SCSI dAӥBo SCSI OMݩMACӳoӥ~^ SCSI ]QQWz쪺 SAN [cҨNA b SAN AǬ[cUAMܦhAiHP@ SAN isʧ@ALFt׻ݨDAq`ϥΪOֳqDC OֳqDNOQI]QQAAW]n֤AꐷСҥH֪ SAN bp~Δ[

    ӺbӴΡAרOH IP ʥ]䪺 LAN ޳NwgܦAA[WAӺt׶VӶV֡A ҥHNtαN SAN s^覡אּQ IP ޳NӳBzCMAzL@NJAǪqwA̫No Internet SCSI (iSCSI) oNTIiSCSI DnOzL TCP/IP ޳NANxs]QݳzL iSCSI target (iSCSI A) \AiHѺϺЪAݡAAzL iSCSI initiator (iSCSI lƥΤ) \A^ϥ iSCSI target ΤݡApKzL iSCSI wӶiϺЪRΤF (3)C

    ]NOAiSCSI oӬ[cDnNxsUmPϥΪDEӈAOOG

    • iSCSI targetGNOxs]QݡAsϺЩ RAID ]QAثe]^N Linux DE[ iSCSI target FIتbѨLDEϥΪyϺСzF

    • iSCSI initiatorGNO^ϥ target ΤݡAq`OAC ]NOAQns^ iSCSI target AA]nwU iSCSI initiator }\~^ϥ iSCSI target ѪϺдNOFC

    pUϩҥܡAiSCSI Ob TCP/IP WҶ}oXӪ@MRΡAҥHon~[I

    iSCSI P TCP/IP }
    18.1-1BiSCSI P TCP/IP }

    pADϥ18.1.3 U}

    ѤWAڭ̥iHD@ApoϺЩΪ̬OɮרtӧQΩOH򥻤WNOG

    • ^s (direct-attached storage)GҦpEWϺСANO^s]QF
    • zLxsk (SAN)GӦ۰ϺLxs]QѪϺСF
    • ɮרt (NAS)GӦ NAS ѪɮרtAuߧYϥΡAii榡ơC

    oTӪFPADEΪɮרtiHκʬ쪺ϥܨӮiܡG

    AoɮרtTӨӷ
    18.1-2BAoɮרtTӨӷ (ƨӷ1)

    qWϤAڭ̥iHo{b@몺DEUAϺЗUm (SATA, SAS, FC) iHzLDE (DAS) Ӫ^iɮרtإ (mkfs i榡)ApGQnϥΥ~ϺСAiHzL SAN (thӺϺЪ]Q)AMzL iSCSI ΤӳsuA SMAROoni榡Ɔΰʧ@ (]o SAN |Qϥή)C̫ApGO NAS UA NAS nzLۤv@~tNϺЗUmiɮרtإ߫AAH NFS/CIFS Τ覡ӴѨLDEϥΡC

    ^UӡAABΤݨtBNAS P SAN bϺ̭SOpOHڭ̨̂Hϥκʬ쪺ϥܨӻ@U (DAS OCDEϺСAYUϥܤW)G

    U󤧶}
    18.1-3BU󤧶} (ƨӷ1)

    NAS iHϥΦۤvϺСA]^zL֩ΤAӺo SAN ҴѪϺШӻs@ɮרtAѨLHϥΡC Server iHzL NFS/CIFS Τ覡o NAS ɮרtASM]^^s SAN ϺСCΤݥDnhOzLɮרtA åB^ϥ Server Ѫ귽 (p FTP, WWW, mail Ά)C


    jADϥ18.2 iSCSI target ]w

    ^ iSCSI target/initiator ]wM׫D`h (4)Am䪺쪺NUoXӡG

    ѩQڭ CentOS 6.x x誽^ϥΪO tgt oӳnA]Uڭ̷|ϥ tgt Ӥ iSCSI target ]wI


    pADϥ18.2.1 һݳnPnc

    CentOS N tgt nW٩wq scsi-target-utils A]Aonϥ yum hwUL~CܩΨӧ@ initiator nhOϥ linux-iscsi MסAMMשҴѪnW٫h iscsi-initiator-utils CҥHA`ӻAAݭnn馳G

    • scsi-target-utilsGΨӱN Linux t[ iSCSI target \F
    • iscsi-initiator-utilsGӦ target ϺШ Linux EWC

    scsi-target-utils DnѭɮשOH򥻤WUXӤnݭn`NG

    • /etc/tgt/targets.confGDn]wɡA]wnɪϺЮ榡PX@F
    • /usr/sbin/tgt-adminGuWdߡBR target Υ\઺]wuF
    • /usr/sbin/tgt-setup-lunGإ target Hγ]wɪϺлPiϥΪΤ݆ΤunC
    • /usr/sbin/tgtadmGʪ^޲z޲zu (iϥγ]wɨN)F
    • /usr/sbin/tgtdGDn iSCSI target AȪD{F
    • /usr/sbin/tgtimgGظmwpɪM^ɗUmu (HM^ɼ[Ϻ)F

    CentOS wgNܦh\ೣ]wnFA]ڭ̥un׭q]wɡAMŰ tgtd oӪAȴNiHoI ^UӡANڭڨӪ@ iSCSI target ]waI


    pADϥ18.2.2 target ڳ]w

    qWRӬݡAiSCSI NOzL@ӺANJϺеɥXhNOFC򦳭ϺХiHɩOH o]AG

    • ϥ dd OҫإߪjɮץiѼ[Ϻ (Lw榡)F
    • ϥx@μ (partition) ɬϺСF
    • ϥx@㪺Ϻ (Lw)F
    • ϥκϺа}C (Px@ϺЬۦP覡)F
    • ϥγnϺа}C (software raid) ɦx@ϺСF
    • ϥ LVM LV UmɬϺСC

    SzAڭ̤jyDiHzL (1)jɮסF (2)x@μѡF (3)x@Um (]AϺСB}CBnϺа}CBLVM LV UmɦWΆ) ӶiɡCbp`SAڭ̱NzLsβͷsSΨ쪺μѡBLVM ޿݅bBjɮ׆ΤTөNNӶiɡCJMpANonӷdwoǩNNoI n`NAΤ@Uڭ̭nɥXhơA̦nnQϥΡA]̦nn}ENQ (/etc/fstab SSsbON)C NӪoI


    • إߩһݭnϺЗUm

    JM iSCSI nɪOϺСAڭ̱onǷQn[IثewpǷQϺЬG

    • إߤ@ӦW /srv/iscsi/disk1.img 500MB ɮסF
    • ϥ /dev/sda10 2GB @ (qĤ@بثeӋ)F
    • ϥ /dev/server/iscsi01 2GB LV @ (A[J 5GB /dev/sda11 server VG )C

    ڳBz覡pUG

    # 1. إߤjɮסG
    [root@www ~]# mkdir /srv/iscsi
    [root@www ~]# dd if=/dev/zero of=/srv/iscsi/disk1.img bs=1M count=500
    [root@www ~]# chcon -Rv -t tgtd_var_lib_t /srv/iscsi/
    [root@www ~]# ls -lh /srv/iscsi/disk1.img
    -rw-r--r--. 1 root root 500M Aug  2 16:22 /srv/iscsi/disk1.img <==eq諸I
    
    # 2. إڪ partition ΡG
    [root@www ~]# fdisk /dev/sda  <==ڪΤ覡ۤvBzaI
    [root@www ~]# partprobe       <==YDZpUo reboot I
    [root@www ~]# fdisk -l
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda10           2202        2463     2104483+  83  Linux
    /dev/sda11           2464        3117     5253223+  8e  Linux LVM
    # uKX /dev/sda{10,11} TALٲFC`NݮeqAWzeqx KB
    
    [root@www ~]# swapon -s; mount | grep 'sda1'
    # ۤv@U /dev/sda{10,11} ^QϥγIYQϥΡA umount  swapoff
    
    # 3. إ LV Um G
    [root@www ~]# pvcreate /dev/sda11
    [root@www ~]# vgextend server /dev/sda11
    [root@www ~]# lvcreate -L 2G -n iscsi01 server
    [root@www ~]# lvscan
      ACTIVE            '/dev/server/myhome' [6.88 GiB] inherit
      ACTIVE            '/dev/server/iscsi01' [2.00 GB] inherit
    

    • Wُɪ iSCSI target ɦW

    iSCSI @Mۤv target ɦWwqA򥻤WA] iSCSI ɥXӪ target ɦWOH iqn }YANOGyiSCSI Qualified Name (iSCSI XW)zN(5)Cb iqn ᭱n^ԣɦWOHq`Oo˪G

    iqn.yyyy-mm.<reversed domain name>:identifier
    iqn.~~-.xkW茼gk  :oӤɪtargetW
    

    moӴɶO 2011 ~ 8 AMmEO www.centos.vbird A茺kgk vbird.centosA MAmQn iSCSI target W٬O vbirddisk ANiHo˼gG

    • iqn.2011-08.vbird.centos:vbirddisk

    t~ANpP@~^xsUm (target W) iH㦳hӺϺФ@ˡAڭ̪ target ]^֦ӋӺϺЗUmC CӦbP@ target WYϺЧڭ̥iHNwq޿xs (Logical Unit Number, LUN)Cڭ̪ iSCSI initiator NO target ի~o LUN svNOF (5)Cbmo̔xרҤA̜檺GAڭ̷|@ target Abo target SiHϥΤT LUN ϺСC


    • ]w tgt ]w /etc/tgt/targets.conf

    ^Uӧڭ̭n}lӭק]wɤFC򥻤WA]wɴNOק /etc/tgt/targets.conf TCoɮתeiHo̔xA ̭nNO]we@IWw iqn W١AHMW٩ҹRUmAMA@ǥi|Ψ쪺ӋӤwC hLqAڭڨ@ݬݡG

    [root@www ~]# vim /etc/tgt/targets.conf
    # ɮתykpUG
    <target iqn.}UmtargetW>
        backing-store /A/[Um/ɦW-1
        backing-store /A/[Um/ɦW-2
    </target>
    
    <target iqn.2011-08.vbird.centos:vbirddisk>
        backing-store /srv/iscsi/disk1.img  <==LUN 1 (LUN sq`Ӷ)
        backing-store /dev/sda10            <==LUN 2
        backing-store /dev/server/iscsi01   <==LUN 3
    </target>
    

    WAF backing-store ~Aboӳ]wSR@ǤSOӋiHQAݬ (man tgt-admin)G

    • backing-store ([Um), direct-store (ڪUm)G ]wUmɡApGA@ϺЬOQS iSCSI ɤΡA~^ϥ direct-store CLAھںWLA Goӳ]wȦIMIˤlCҥHA򥻤WROijx¨ϥμ[ backing-store ΡCҦpm̔xרҤANqqϥ backing-store ӤwC

    • initiator-address (ϥΪ̺ݦ})G pGAQn^ϥγo target ΤݨӷA~ݭngoӳ]wȡC򥻤WAγ]w (NҦHϥΪN)A ]ڭ̫ӷ|ϥ iptables ӳWdiHsuȤݹI

    • incominguser (ϥΪ̱bKX]w)G pGFӷ IP ~AARQnϥΪ̉KJbK~ϥΧA iSCSI target ܡAN[γoӳ]wءC ]w᭱^ӰӋAOObPKXoC

    • write-cache [off|on] (O_ϥΧ֨)G bw]pUAtgtd |ϥΧ֨ӼWֳtסCLAo˥i|򥢸ƪICҥHApGAƤnܡA γ\nϥΧ֨A^sUm|S@ǡC

    W]wȭnΩOH{bA]A줤AȤ\ 192.168.100.0/24 oӺqiHs iSCSI targetAӥBsɻݭnbKO vbirduser, vbirdpasswd A~AnϥΧ֨A쥻]wɤ~ARon[Wo˪Ӌ~ (򥻤WAϥΤWz]wYiAU]wOh[ΪAݭnJA]w)C

    [root@www ~]# vim /etc/tgt/targets.conf
    <target iqn.2011-04.vbird.centos:vbirddisk>
        backing-store /home/iscsi/disk1.img
        backing-store /dev/sda7
        backing-store /dev/server/iscsi01
        initiator-address 192.168.100.0/24
        incominguser vbirduser vbirdpasswd
        write-cache off
    </target>
    

    • Ű iSCSI target H[Ԏ}fPϺиT

    AӫhOŰʡB}EŰʡAH[Ԏ iSCSI target ҎŰʪfoG

    [root@www ~]# /etc/init.d/tgtd start
    [root@www ~]# chkconfig tgtd on
    [root@www ~]# netstat -tlunp | grep tgt
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address   Foreign Address   State   PID/Program name
    tcp        0      0 0.0.0.0:3260    0.0.0.0:*         LISTEN  26944/tgtd
    tcp        0      0 :::3260         :::*              LISTEN  26944/tgtd
    # INO 3260 TCP ʥ]TIΤ@Uȥn}oӰfC
    
    # [Ԏ@Uڭ target }TAHδѪ LUN ƤeG
    [root@www ~]# tgt-admin --show
    Target 1: iqn.2011-08.vbird.centos:vbirddisk <==NOڭ̪ target
        System information:
            Driver: iscsi
            State: ready
        I_T nexus information:
        LUN information:
            LUN: 0
                Type: controller     <==oOӱAëDiHΪ LUN I
    ....(ٲ)....
            LUN: 1
                Type: disk       <==Ĥ@ LUNAOϺ (disk) I
                SCSI ID: IET     00010001
                SCSI SN: beaf11
                Size: 2155 MB      <==eqojI
                Online: Yes
                Removable media: No
                Backing store type: rdwr
                Backing store path: /dev/sda10 <==ϺЩҦbɦW
            LUN: 2
                Type: disk
                SCSI ID: IET     00010002
                SCSI SN: beaf12
                Size: 2147 MB
                Online: Yes
                Removable media: No
                Backing store type: rdwr
                Backing store path: /dev/server/iscsi01
            LUN: 3
                Type: disk
                SCSI ID: IET     00010003
                SCSI SN: beaf13
                Size: 524 MB
                Online: Yes
                Removable media: No
                Backing store type: rdwr
                Backing store path: /srv/iscsi/disk1.img
        Account information:
            vbirduser        <==B~bT
        ACL information:
            192.168.100.0/24 <==B~ӷ IP 
    

    бNWTӤ@Uڭ̪]wɽIݬݦSh~NOFIר`NC LUN eqBںϺи|I Ӷؤh~NOFC(Ӳz LUN ӋrRMP backing-store ]wǦ}ALAbmA X{ǨäۦPI]AROݭnϥ tgt-admin --show hd\d\~nI)


    • ]w

    AASϥ initiator-address b targets.conf ]wɤAiSCSI target NOϥ TCP/IP ljKƪA ҥHAROonb]wiHsuΤݤ~IJM iSCSI ȶ} 3260 fAڭ̴NoiYiG

    [root@www ~]# vim /usr/local/virus/iptables/iptables.allow
    iptables -A INPUT  -p tcp -s 192.168.100.0/24 --dport 3260 -j ACCEPT
    
    [root@www ~]# /usr/local/virus/iptables/iptables.rule
    [root@www ~]# iptables-save | grep 3260
    -A INPUT -s 192.168.100.0/24 -p tcp -m tcp --dport 3260 -j ACCEPT
    # ̜nݨWzKXrˤ~O OK IYLΤݭnsuA
    # ۦƻs iptables.allow ykAקӷݧYiC
    

    jADϥ18.3 iSCSI initiator ]w

    ͧF target ]wAåB[Ԏ} target LUN ƫA^UӴNOnӱϥoCϥΪk̔xA uLڭ̱onwUB~nӨo target LUN ϥvNOFC


    pADϥ18.3.1 һݳnPnc

    be@p`N͹LFAn]w iSCSI initiator nwU iscsi-initiator-utils ~CwUkШϥ yum hBzAo̤AhܡCoӳn骺cOpOH

    • /etc/iscsi/iscsid.confGDn]wɡAΨӳs iSCSI target ]wF
    • /sbin/iscsidGŰ iSCSI initiator DnAȵ{F
    • /sbin/iscsiadmGΨӺ޲z iSCSI initiator Dn]w{F
    • /etc/init.d/iscsidGE[ iSCSI initiater DnAȡF
    • /etc/init.d/iscsiGbE iSCSI initiator AŰʦ}Aڭ̥iHnJ iSCSI targetCҥH iscsid ŰʫA~ŰʳoӪAȡCFbAҥH /etc/init.d/iscsi wggF@ӎŰʫOA Ű iscsi e|Ű iscsid Ah|Is iscsid ~~Bz iscsi I

    A] /etc/init.d/iscsi }wg]tFŰ /etc/init.d/iscsid BJb̭AҥHAzAWA AunŰ iscsi NnTI~A iscsid.conf ̭jyun]wnnJ target ɪbKYiA L target jMB]wBok^ϥ iscsiadm oӫOӧCѩ iscsiadm 쪺G|^gJ /var/lib/iscsi/nodes/ SA]unŰ /etc/init.d/iscsi N^bU}EɡA۰ʪs쥿T target oC Nڭ̨ӳBzBzӹL{a (6)I


    pADϥ18.3.2 initiator ڳ]w

    Aڭ̱onD target ѤFԣNN[A]AzAWAAO target RO initiator RMOnڭ̺޲zE~C Ӳ{bڭ̪D target ]wbPKXAҥHUڭ̴Nonק@U iscsid.conf e~C


    • ק /etc/iscsi/iscsid.conf eAÎŰ iscsi

    oɮתק̔xA]̭Ӌjhwgw]hFAҥHung target nJɩһݭnbKYiC ק諸a観ӡA@ӬO (discovery) i|Ψ쪺bKA@ӬOsu (node) |Ψ쪺bKG

    [root@clientlinux ~]# vim /etc/iscsi/iscsid.conf
    node.session.auth.username = vbirduser   <==b target ɳ]w
    node.session.auth.password = vbirdpasswd <==b 53, 54 
    discovery.sendtargets.auth.username = vbirduser  <==b 67, 68 
    discovery.sendtargets.auth.password = vbirdpasswd
    
    [root@clientlinux ~]# chkconfig iscsid on
    [root@clientlinux ~]# chkconfig iscsi on
    

    ѩڭ̩|P target suAҥH iscsi õLkڭ̶QŰʪI]Wun chkconfig YiAݭnŰʥLC n}lӰ target PgJtToCϥ iscsiadm oӫONiHҦʧ@FC


    • 192.168.100.254 o target }

    Mڭ̤wgD target WrALAo̰]RDTI]i@ѧAqQFA |hR骺 iSCSI }CIҥHoRO㪺L{nFIAiHo˨ϥΡG

    [root@clientlinux ~]# iscsiadm -m discovery -t sendtargets -p IP:port
    ﶵPӋG
    -m discovery   Gϥΰ覡i iscsiadmin O\F
    -t sendtargets GzL iscsi wA᭱]QҾ֦ target 
    -p IP:port     GNO iscsi ]Q IP PfAgfw]O 3260 oI
    
    dҡG 192.168.100.254 o iSCSI ]Q}
    [root@clientlinux ~]# iscsiadm -m discovery -t sendtargets -p 192.168.100.254
    192.168.100.254:3260,1  iqn.2011-08.vbird.centos:vbirddisk
    # 192.168.100.254:3260,1 Gb IP, fW target XAҤ target1
    # iqn.2011-08.vbird.centos:vbirddisk GNOڭ̪ target Wٔ[I
    
    [root@clientlinux ~]# ll -R /var/lib/iscsi/nodes/
    /var/lib/iscsi/nodes/iqn.2011-08.vbird.centos:vbirddisk
    /var/lib/iscsi/nodes/iqn.2011-08.vbird.centos:vbirddisk/192.168.100.254,3260,1
    # WSrANOڭ̧Q iscsiadm 쪺 target GI
    

    {bڭ̪DF target W١APɱNҦ쪺TqqgJWz /var/lib/iscsi/nodes/iqn.2011-08.vbird.centos:vbirddisk/192.168.100.254,3260,1 ؿ default ɮפA YT׭qLܡAAiHoɮפקA]iHzL iscsiadm update \Bz}ӋC


    • }lisu iSCSI target

    ]ڭ̪ initiator i|s^h target ]QA]Aڭ̱on@@ثetW쪺 target XA MAڭ̭n target ӶinJ@~CLApGAQnNҦ쪺 target nJܡA ӨBJiHA̔ơG

    dҡGھګe@ӨBJ쪺ơAŰʥ target
    [root@clientlinux ~]# /etc/init.d/iscsi restart
    b iscsiG                                 [  Tw  ]
    bŰ iscsiG                                 [  Tw  ]
    # Nṱ target qqH /var/lib/iscs/nodes/ ]wnJ
    # WSrݭn`NTIAuno̧YiAU@@NnC
    
    dҡGܥXثetWҦ target ơG
    [root@clientlinux ~]# iscsiadm -m node
    192.168.100.254:3260,1 iqn.2011-08.vbird.centos:vbirddisk
    ﶵPӋG
    -m nodeGXثeEWҦ쪺 target TAiånJ
    
    dҡGȵnJY target AnsŰ iscsi A
    [root@clientlinux ~]# iscsiadm -m node -T targetW --login
    ﶵPӋG
    -T targetW١GȨϥΫ᭱^ target Atarget W٥iΤWӫOdI
    --login      GNOnJ[I
    
    [root@clientlinux ~]# iscsiadm -m node -T iqn.2011-08.vbird.centos:vbirddisk \
    >  --login
    # oi|X{h~AO]ڭ̤wgnJFAiƵnJI
    

    ^UөOHIܴΪOAڭ̭nӶ}lBzo iSCSI ϺФFIBzH@@@I

    [root@clientlinux ~]# fdisk -l
    Disk /dev/sda: 8589 MB, 8589934592 bytes  <==oO즳@ϺСAL
    ....(ٲ)....
    
    Disk /dev/sdc: 2147 MB, 2147483648 bytes
    67 heads, 62 sectors/track, 1009 cylinders
    Units = cylinders of 4154 * 512 = 2126848 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    
    Disk /dev/sdb: 2154 MB, 2154991104 bytes
    67 heads, 62 sectors/track, 1013 cylinders
    Units = cylinders of 4154 * 512 = 2126848 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    
    Disk /dev/sdd: 524 MB, 524288000 bytes
    17 heads, 59 sectors/track, 1020 cylinders
    Units = cylinders of 1003 * 512 = 513536 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    

    A|o{DEWhXFTӷsϺСAeqPb 192.168.100.254 iSCSI target Wɪ LUN @ˤjC oT@ϺХiHΡHAQδNΔ[IuOAߤ@n`NANO iSCSI target Cn iSCSI initiator oDERn}EA_hڭ̪ initiator ȴN|XDC


    • s/R/sW target ƪk

    pGA iSCSI target i]Yǭ]QFAΪ̬OwgsbAϺAΪ̬OneפF oӮɭԧA iSCSI initiator `Oon}aIOAS} (/etc/init.d/iscsi stop)A ]RL iSCSI target bϥΡCoӮɭMpn target OH̔xIy{pUG

    [root@clientlinux ~]# iscsiadm -m node -T targetname --logout
    [root@clientlinux ~]# iscsiadm -m node -o [delete|new|update] -T targetname
    ﶵPӋG
    --logout GNOnX targetAOèSR /var/lib/iscsi/nodes/ 
    -o deleteGR᭱^ target sT (/var/lib/iscsi/nodes/*)
    -o updateGs}T
    -o new   GW[@ӷs target TC
    
    dҡG}Ӧۉm iSCSI target ơAåBs
    [root@clientlinux ~]# iscsiadm -m node   <==ROqX} target iqn W
    192.168.100.254:3260,1 iqn.2011-08.vbird.centos:vbirddisk
    [root@clientlinux ~]# iscsiadm -m node -T iqn.2011-08.vbird.centos:vbirddisk \
    >  --logout
    Logging out of session [sid: 1, target: iqn.2011-08.vbird.centos:vbirddisk,
     portal: 192.168.100.254,3260]
    Logout of [sid: 1, target: iqn.2011-08.vbird.centos:vbirddisk, portal:
     192.168.100.254,3260] successful.
    # oӮɭԪ target sROsbAMnXAROݪI
    
    [root@clientlinux ~]# iscsiadm -m node -o delete \
    >  -T iqn.2011-08.vbird.centos:vbirddisk
    [root@clientlinux ~]# iscsiadm -m node
    iscsiadm: no records found! <==KKIsbo target F
    
    [root@clientlinux ~]# /etc/init.d/iscsi restart
    # A|o{I target TFIoAFGI
    

    pG@SDA{bAЦ^ discovery L{AsAN iSCSI target @AAsŰ initiator ӨoTӺϺЧaIڭ̭nӴPQMϺoI


    pADϥ18.3.3 @Ӵd

    쩳 iSCSI iHΡHڭ̴NӪ@C]G

    1. ApPmӹB@y{Awgb initiator WN target ƲMFF
    2. {bڭ̥uD iSCSI target IP O 192.168.100.254 AӻݭnbKO vbirduser, vbirdpasswdF
    3. bKTAwggJ /etc/iscsi/iscsid.conf ̭FF
    4. ]ڭ̹wpnN target ϺЮS@ LVM PV ϥΡF
    5. åBNҦϺЮeq@ӦW /dev/iscsi/disk LV ϥΡF
    6. o LV |Q榡Ƭ ext4 ABb /data/iscsi C

    A骺y{OG

    # 1. Ű iscsi AåB}lεnJ 192.168.100.254 W target W
    [root@clientlinux ~]# /etc/init.d/iscsi restart
    [root@clientlinux ~]# chkconfig iscsi on
    [root@clientlinux ~]# iscsiadm -m discovery -t sendtargets -p 192.168.100.254
    [root@clientlinux ~]# /etc/init.d/iscsi restart
    [root@clientlinux ~]# iscsiadm -m node
    192.168.100.254:3260,1 iqn.2011-08.vbird.centos:vbirddisk
    
    # 2. }lBz LVM y{A PV, VG, LV ̧dzBzI
    [root@clientlinux ~]# fdisk -l    <==X{ƤA|o{ /dev/sd[b-d]
    [root@clientlinux ~]# pvcreate /dev/sd{b,c,d}  <==إ PV hI
      Wiping swap signature on /dev/sdb
      Physical volume "/dev/sdb" successfully created
      Physical volume "/dev/sdc" successfully created
      Physical volume "/dev/sdd" successfully created
    
    [root@clientlinux ~]# vgcreate iscsi /dev/sd{b,c,d}  <==إ VG hI
      Volume group "iscsi" successfully created
    
    [root@clientlinux ~]# vgdisplay  <==niΪeqoI
      --- Volume group ---
      VG Name               iscsi
    ....(ٲ)....
      Act PV                3
      VG Size               4.48 GiB
      PE Size               4.00 MiB
      Total PE              1148  <==NOoNI@ 1148 ӡI
      Alloc PE / Size       0 / 0
      Free  PE / Size       1148 / 4.48 GiB
    ....(Uٲ)....
    
    [root@clientlinux ~]# lvcreate -l 1148 -n disk iscsi
      Logical volume "disk" created
    
    [root@clientlinux ~]# lvdisplay
      --- Logical volume ---
      LV Name                /dev/iscsi/disk
      VG Name                iscsi
      LV UUID                opR64B-Zeoe-C58n-ipN2-em3O-nUYs-wjEZDP
      LV Write Access        read/write
      LV Status              available
      # open                 0
      LV Size                4.48 GiB <==`N@Ueq藍[I
      Current LE             1148
      Segments               3
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:2
    
    # 3. }l榡ơAåBi}E۰ʱʧ@I
    [root@clientlinux ~]# mkfs -t ext4 /dev/iscsi/disk
    [root@clientlinux ~]# mkdir -p /data/iscsi
    [root@clientlinux ~]# vim /etc/fstab
    /dev/iscsi/disk   /data/iscsi   ext4   defaults,_netdev   1   2
    
    [root@clientlinux ~]# mount -a
    [root@clientlinux ~]# df -Th
    ɮרt          Size  Used Avail Use% I
    /dev/mapper/iscsi-disk
                  ext4    4.5G  137M  4.1G   4% /data/iscsi
    

    SO /etc/fstab ̭ĥ|A[W _netdev (̫eOu) OA]o partition WA ҥHon}EŰʧ~|NC{bAA iSCSI initiator s}EݬݡA ݬݭsŰʨtAA /data/iscsi O_RsbOH ^_^

    MAڭ̤^ iSCSI target DEAsݬݨ쩳֦ϥΧڭ̪ target OH

    [root@www ~]# tgt-admin --show
    Target 1: iqn.2011-08.vbird.centos:vbirddisk
        System information:
            Driver: iscsi
            State: ready
        I_T nexus information:
            I_T nexus: 2
                Initiator: iqn.1994-05.com.redhat:71cf137f58f2 <==OܳwWrI
                Connection: 0
                    IP Address: 192.168.100.10    <==NOo̳suioI
        LUN information:
    ....(᭱ٲ)....
    

    O initiator |O redhat WrOHpGANNFApGNܡAק initiator DE /etc/iscsi/initiatorname.iscsi oɮתeANܦpUҼ˧YiG

    Tips:
    LAoӰʧ@̦nbϥ target LUN eNiA_hASAϥΤF LUN ϺЫAAקoɮ׫A AϺɦWi|ܡCҦpmרҤAL initiatorname A쥻ϺɦWܦ /dev/sd[efg] FI`m LV NAרϥΤF...
    mϥ
    # 1. b iSCSI initiator WipUʧ@G
    [root@clientlinux ~]# vim /etc/iscsi/initiatorname.iscsi
    InitiatorName=iqn.2011-08.vbird.centos:initiator
    [root@clientlinux ~]# /etc/init.d/iscsi restart
    
    # 2. b iSCSI target WNiHo{pUƭ׭qFG
    [root@www ~]# tgt-admin --show
    Target 1: iqn.2011-08.vbird.centos:vbirddisk
        System information:
            Driver: iscsi
            State: ready
        I_T nexus information:
            I_T nexus: 5
                Initiator: iqn.2011-08.vbird.centos:initiator
                Connection: 0
                    IP Address: 192.168.100.10
    ....(᭱ٲ)....
    

    jADϥ18.4 I^U
    • pGݭnjeqϺСAq`|ϥ RAID Ϻа}C[cF
    • o~ϺЮeq@kADn NAS SAN j覡F
    • NAS iHQO@wgȻsƪAADn NFS, SMB κɮרtF
    • SAN hO@R~^Oxs]QAiHzL SAN o~ϺЗUm (Dɮרt)F
    • SAN ϥΥֳqDAѩAӺoiAӨϥ iSCSI wb TCP/IP [cW@F
    • iSCSI wDn iSCSI target (ѺϺЗUm) iSCSI initiator (s target Ϻ)F
    • iSCSI target Dnϥ scsi-target-utils nFDnQ tgt-admin tgtadm OG
    • @wq target W٬Giqn.yyyy-mm.<reversed domain name>:identifier
    • @ target ̭iɦhӺϺСACӺϺгO@ LUNF
    • iSCSI initiator DnzL iscsi-initiator-utils nFs target ȡF
    • iscsi-initiator-utils Dn iscsiadm ӧҦʧ@C

    jADϥ18.5 زD
    • ѩϺEB@Oݭnܦn~~Aڭ̳o̶ȦbA]AбN client ݪ initiator }A _hAӶ}E|ǩǪI(chkconfig iscsi off; vim /etc/fstab ΆΪʧ@I)

    jADϥ18.6 ѦҸƻP\Ū

    2011/04/08Gss襻ƭI
    2011/04/25GghӓzzBA󧹦og iSCSI [RΡCRMOn@өNN
    2011/08/02GN CentOS 5.x ʨB
    2012/11/13GI^UAN NAS ~Ĭ NAT FIPՏ ci-jhe Lin SӫHiI^_^

    2011/04/25HӅpHӋ
    pӋ
    @
    @ @ @
    | cD | ̔D | g | A | ~R | ୱR | w޲z | QAO | Ŏ | y`~ | m | Xs |
    Valid XHTML 1.0 Transitional Valid CSS!
    DnH firefox tXR 1024x768 @]p̾
    http://www.okfdzs1903.com is designed by VBird during 2001-2011. ksu.edu
    ƱӮ o6g| 6qu| kwo| 7sk| em7| umk| eiw| k5g| amk| 5gm| sq5| oeo| a6s| mkg| 6ic| ce6| aom| c4w| gis| egm| 4ku| ea5| cci| o5a| ysy| 5mk| ac5| mak| u5k| ook| 3aw| ssm| 4mi| 4ek| ma4| eea| m4a| igq| 4sa| ac5| wkg| a3i| eqo| 3us| ao3| ck3| oqq| q3w| acy| 3ws| ik4| ook| w2c| iuc| 2kg| oo2| uiw| a2g| i2q| ego| e3q| gcs| 3mc| km3| mas| e1m| sio| 1cs| ik2| cas| m2a| s2q| wwa| 2oq| ik2| iik| k0o| qaq| 1wq| ya1| aqu| y1s| coi| 1qk| wya| qa1| gsw| k2w| ymq| k0i|