Upgrade to Pro — share decks privately, control downloads, hide ads and more …

俺がSCSIだ

Fadis
May 09, 2015

 俺がSCSIだ

iSCSIをマウントする手順、iSCSIターゲットを提供する手順、iSCSI非対応機器でiSCSIをマウントする方法について解説します

Fadis

May 09, 2015
Tweet

More Decks by Fadis

Other Decks in Technology

Transcript

  1. iSCSI RFCͰඪ४Խ͞Ε͍ͯΔ 3'$ J4$4*ͷجຊతͳن֨ 3'$ ໨తͷλʔήοτΛݟ͚ͭΔํ๏ 3'$ ΠχγΤʔλ΍λʔήοτͷ໊લͷॻ͖ํ 3'$ ೝূʹ͍ͭͯ

    3'$ J4$4*ରԠػث͕ຬͨ͢΂͖ཁ݅ʹ͍ͭͯ 3'$ J4$4*ͷίϚϯυͷ࣮ߦॱংʹ͍ͭͯͷ஫ҙࣄ߲ 3'$ ຊՈͷ4$4*ͷ࢓༷͕ߋ৽͞Ε͔ͨΒ௥ै͢Δͥ 3'$ 4-1WͰJ4$4*୳ͤΔΑ͏ʹ͢Δ֦ு ଞଟ਺
  2. Linux؀ڥͰiSCSIλʔήοτΛϚ΢ϯτ͠Α͏ $ iscsid Open-iSCSIͷσʔϞϯΛىಈ $ iscsiadm -m discovery -t st

    -p 192.168.152.1 -P 1! Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.406262d1b87f! !Portal: 192.168.152.1:3260,1! !!Iface Name: iface0! Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.f3d75f94ab5f! !Portal: 192.168.152.1:3260,1! !!Iface Name: iface0 ϙʔλϧʹ઀ଓͯ͠λʔήοτΛ୳͢ iSCSIϙʔλϧͷϗετ iSCSIλʔήοτͷ໊લ
  3. $ iscsiadm -m node --targetname \! iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.f3d75f94ab5f --login! Logging in

    to [iface: iface0, target: iqn.2003-01.org.linux- iscsi.hahnela.x8664:sn.f3d75f94ab5f, portal: 192.168.152.1,3260]! Login to [iface: iface0, target: iqn.2003-01.org.linux- iscsi.hahnela.x8664:sn.f3d75f94ab5f, portal: 192.168.152.1,3260] successful. iSCSIλʔήοτʹϩάΠϯ iSCSIλʔήοτͷ໊લ Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.406262d1b87f! !Portal: 192.168.152.1:3260,1! !!Iface Name: iface0! Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.f3d75f94ab5f! !Portal: 192.168.152.1:3260,1! !!Iface Name: iface0 ϙʔλϧʹ઀ଓͯ͠λʔήοτΛ୳͢
  4. iscsi.hahnela.x8664:sn.f3d75f94ab5f, portal: 192.168.152.1,3260] successful. iSCSIλʔήοτʹϩάΠϯ [776839.671781] scsi host10: iSCSI Initiator

    over TCP/IP! [776839.932116] scsi 10:0:0:0: Direct-Access LIO-ORG IBLOCK 4.0 PQ: 0 ANSI: 5! [776839.933116] sd 10:0:0:0: Attached scsi generic sg2 type 0! [776839.933865] sd 10:0:0:0: [sdc] 41943040 512-byte logical blocks: (21.4 GB/20.0 GiB)! [776839.933872] sd 10:0:0:0: [sdc] 4096-byte physical blocks! [776839.936005] sd 10:0:0:0: [sdc] Write Protect is off! [776839.936012] sd 10:0:0:0: [sdc] Mode Sense: 43 00 10 08! [776839.936422] sd 10:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA! [776839.962054] sdc: unknown partition table! [776839.965261] sd 10:0:0:0: [sdc] Attached SCSI disk ৽͍͠SCSIσΟεΫ͕ݱΕͨ
  5. $ mount -t auto /dev/sdc /mnt/iscsi! $ mount|grep /mnt/iscsi! /dev/sdc

    on /mnt/iscsi type ext4 (rw) Linux؀ڥͰiSCSIλʔήοτΛϚ΢ϯτ͠Α͏ ͋ͱ͸ϩʔΧϧͷσΟεΫͱಉ͡Α͏ʹ࢖͑Δ $ umount /dev/sdc! $ iscsiadm -m node --targetname \! iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.f3d75f94ab5f —logout! Logging out of session [sid: 7, target: iqn.2003-01.org.linux- iscsi.hahnela.x8664:sn.f3d75f94ab5f, portal: 192.168.152.1,3260]! Logout of [sid: 7, target: iqn.2003-01.org.linux- iscsi.hahnela.x8664:sn.f3d75f94ab5f, portal: 192.168.152.1,3260] successful. ཁΒͳ͘ͳͬͨΒumountͯ͠ϩάΞ΢τ iSCSIλʔήοτͷ໊લ
  6. ଎͍ $ dd if=/dev/zero of=./hoge.img bs=1024 count=500K! 512000+0 Ϩίʔυೖྗ! 512000+0

    Ϩίʔυग़ྗ! 524288000 όΠτ (524 MB) ίϐʔ͞Ε·ͨ͠ɺ 9.79909 ඵɺ 53.5 MB/ඵ $ dd if=/dev/zero of=./hoge.img bs=1024 count=500K! 512000+0 Ϩίʔυೖྗ! 512000+0 Ϩίʔυग़ྗ! 524288000 όΠτ (524 MB) ίϐʔ͞Ε·ͨ͠ɺ 2.49186 ඵɺ 210 MB/ඵ NFSv4(async)+btrfsͰγʔέϯγϟϧϥΠτ iSCSI+btrfsͰγʔέϯγϟϧϥΠτ 53.5 MB/ඵ 210 MB/ඵ
  7. ଎͍ $ time tar xf linux-3.19.3.tar! ! real! 4m3.048s! user!

    0m0.835s! sys! 0m9.715s $ time tar xf linux-3.19.3.tar ! ! real 0m15.334s! user 0m0.454s! sys 0m3.097s NFSv4(async)+btrfsͰϑΝΠϧΛ୔ࢁ࡞੒ iSCSI+btrfsͰϑΝΠϧΛ୔ࢁ࡞੒ 4෼3ඵ 15ඵ
  8. gcc -Wall -fno-strict-aliasing -I. -D_GNU_SOURCE -c -o server.o server.c! In

    file included from server.c:7:0:! isns.h:249:1: Τϥʔ: ෆ໌ͳܕ໊ ‘time_t’ Ͱ͢! extern time_t isns_object_last_modified(const isns_object_t *);! ^! isns.h:348:1: Τϥʔ: ෆ໌ͳܕ໊ ‘time_t’ Ͱ͢! extern time_t isns_db_expire(isns_db_t *);! ^! isns.h:377:1: Τϥʔ: ෆ໌ͳܕ໊ ‘time_t’ Ͱ͢! extern time_t isns_run_timers(void);! ^! isns.h:500:50: ܯࠂ: ԾҾ਺Ϧετ಺Ͱ ‘struct timeval’ ͕એݴ͞Ε͍ͯ·͢ [σϑΥϧτ Ͱ༗ޮ]! extern isns_message_t * isns_recv_message(struct timeval *timeout);! ^! isns.h:500:50: ܯࠂ: ͦͷείʔϓ͸͜ͷఆٛ·ͨ͸એݴͷΈͰ͢ɻ͜Ε͸ଟ෼ر๬ͨ͠΋ͷͰ͸ ͳ͍Ͱ͠ΐ͏ [σϑΥϧτͰ༗ޮ]! isns.h:671:1: Τϥʔ: ෆ໌ͳܕ໊ ‘time_t’ Ͱ͢! extern time_t isns_scn_transmit_all(void);! HMJCDͰ͸ଞͷϔομ͔ΒJODMVEF͞Ε͍ͯΔϔομΛ ࣗ෼ͰJODMVEF͍ͯ͠ͳ͍
  9. cc -O2 -g -fPIC -Wall -Wstrict-prototypes -I../../include -I../../usr - D_GNU_SOURCE

    -c -o prom_lex.o prom_lex.c! cc -O2 -g -fPIC -Wall -Wstrict-prototypes -I../../include -I../../usr - D_GNU_SOURCE -c -o prom_parse.tab.o prom_parse.tab.c! cc -O2 -g -fPIC -Wall -Wstrict-prototypes -I../../include -I../../usr - D_GNU_SOURCE -c -o fwparam_ppc.o fwparam_ppc.c! fwparam_ppc.c: ؔ਺ ‘loop_devs’ ಺:! fwparam_ppc.c:359:45: Τϥʔ: ‘__compar_fn_t’ ͕એݴ͞Ε͍ͯ·ͤΜ (͜ͷؔ਺಺Ͱͷ࠷ ॳͷ࢖༻)! qsort(niclist, nic_count, sizeof(char *), (__compar_fn_t)nic_cmp);! ^! fwparam_ppc.c:359:45: උߟ: ະએݴͷࣝผࢠ͸ग़ݱ֤ͨؔ͠਺಺ͰҰճͷΈใࠂ͞Ε·͢! fwparam_ppc.c:359:59: Τϥʔ: expected ‘)’ before ‘nic_cmp’! qsort(niclist, nic_count, sizeof(char *), (__compar_fn_t)nic_cmp);! ^! <builtin>: recipe for target 'fwparam_ppc.o' failed! make[1]: *** [fwparam_ppc.o] Error 1! make[1]: Leaving directory '/usr/src/open-iscsi-2.0-873.orig/utils/ fwparam_ibft'! Makefile:30: recipe for target 'user' failed! make: *** [user] Error 2 ඇඪ४ͷܕΛԕྀͳ͘࢖͍ͬͯΔ
  10. $ iscsiadm -m discovery -t st -p 192.168.152.1 -P 1!

    iscsiadm: unrecognized character 'P' ͋ΒΏΔΦϓγϣϯ͕ະ஌ͷΦϓγϣϯѻ͍͞ΕΔ ͜ΕΒΛमਖ਼ͯ͠ग़དྷ্͕ͬͨόΠφϦΛ࣮ߦ͢Δͱ
  11. optopt = 0;! while ((ch = getopt_long(argc, argv, short_options,! long_options,

    &longindex)) >= 0) {! (ུ)! }! if (optopt) {! log_error("unrecognized character '%c'", optopt);! rc = ISCSI_ERR_INVAL;! goto free_ifaces;! } HMJCDͰ͸ͦͷΑ͏ʹಈ͕͘ ಛʹن֨Ͱอূ͞Ε͍ͯΔΘ͚Ͱ͸ͳ͍ڍಈʹґଘ͍ͯ͠Δ getopt͕ࣦഊ࣌ʹҾ਺Λॻ͖ࠐΉάϩʔόϧม਺optoptʹ ੒ޭ࣌ʹ͸Կ΋ॻ͖ࠐ·Εͳ͍͜ͱΛظ଴͍ͯ͠Δ POSIX͸੒ޭ࣌ͷ஋ʹ͍ͭͯԿ΋نఆ͍ͯ͠ͳ͍
  12. gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/uip - I../../../src/unix -I../../../src/unix/libs -I../../../src/apps/ dhcpc

    -I../../../../include -I../../../../usr -g -O2 -O2 -Wall - MT bnx2x.o -MD -MP -MF .deps/bnx2x.Tpo -c -o bnx2x.o bnx2x.c! In file included from ../../../src/unix/nic.h:46:0,! from bnx2x.h:41,! from bnx2x.c:57:! /usr/include/netinet/if_ether.h:96:8: Τϥʔ: ‘struct ethhdr’ ͷ ࠶ఆٛͰ͢! struct ethhdr {! ^! In file included from /usr/include/linux/ethtool.h:17:0,! from bnx2x.c:45:! /usr/include/linux/if_ether.h:137:8: උߟ: ݩʑ͸͜͜Ͱఆٛ͞Ε·ͨ͠! struct ethhdr {! ^! Makefile:352: recipe for target 'bnx2x.o' failed! NVTMMJCDͰ0QFOJ4$4*Λ࢖͏ͷΛఘΊͨ
  13. $ targetcli! Warning: Could not load preferences file /root/.targetcli/prefs.bin.! targetcli

    GIT_VERSION (rtslib GIT_VERSION)! Copyright (c) 2011-2013 by Datera, Inc.! All rights reserved.! Created '/sys/kernel/config/target/loopback'.! Created '/sys/kernel/config/target/iscsi'.! Created '/sys/kernel/config/target/srpt'.! /> ls! o- / ................................................................... [...]! o- backstores ........................................................ [...]! | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> targetcliͰઃఆ
  14. ݸʑͷઃఆ͸ͦΕͧΕͷσΟϨΫτϦʹcdͯ͠ߦ͏ lsͰݱࡏͷσΟϨΫτϦҎԼʹ͋Δઃఆ߲໨Λ֬ೝ /> ls! o- / ................................................................... [...]! o- backstores

    ........................................................ [...]! | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> ಉ໊͡લͷίϚϯυͰ΋σΟϨΫτϦʹΑͬͯػೳ͕ҧ͏఺ʹ஫ҙ
  15. /> ls! o- / ................................................................... [...]! o- backstores ........................................................ [...]!

    | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> backstores ಡΈॻ͖͞ΕΔσʔλΛอଘ͓ͯ͘͠৔ॴ
  16. /> ls! o- / ................................................................... [...]! o- backstores ........................................................ [...]!

    | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> fileio ϑΝΠϧʹσʔλΛอଘ͢Δ
  17. fileio create <ετϨʔδ໊> <ϑΝΠϧ໊> <αΠζ> [ <bufferd> ] /> cd

    /backstores/fileio! /backstores/fileio> create back0 /root/test.img 10M! Generating a wwn serial.! Not using buffered mode.! Created fileio back0.! /backstores/fileio> ls! o- fileio ................................................. [1 Storage Object]! o- back0 ...................................... [/root/test.img deactivated]! /backstores/fileio> createͰ৽͍͠backstoreΛ࡞੒
  18. fileio delete <ετϨʔδ໊> /backstores/fileio> ls! o- fileio ................................................. [1 Storage

    Object]! o- back0 ...................................... [/root/test.img deactivated]! /backstores/fileio> delete back0! Deleted storage object back0.! /backstores/fileio> ls! o- fileio ................................................. [0 Storage Object]! /backstores/fileio> deleteͰbackstoreΛ࡟আ
  19. /> ls! o- / ................................................................... [...]! o- backstores ........................................................ [...]!

    | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> iblock ϒϩοΫσόΠεʹσʔλΛอଘ͢Δ
  20. iblock create <ετϨʔδ໊> <σόΠε໊> /backstores/iblock> cd /! /> cd /backstores/iblock

    ! /backstores/iblock> create back0 /dev/sda4! Generating a wwn serial.! Created iblock storage object back0 using /dev/sda4.! /backstores/iblock> ls! o- iblock ................................................. [1 Storage Object]! o- back0 ........................................... [/dev/sda4 deactivated]! /backstores/iblock> createͰ৽͍͠backstoreΛ࡞੒ delete͸fileioͱಉ͡
  21. /> ls! o- / ................................................................... [...]! o- backstores ........................................................ [...]!

    | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> pscsi SCSIύεεϧʔ SCSIίϚϯυΛLIOͰղऍͤͣʹ ผͷSCSIλʔήοτʹؙ౤͛͢Δ
  22. /> ls! o- / ................................................................... [...]! o- backstores ........................................................ [...]!

    | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> rd_dr/rd_mcp RAMʹσʔλΛอଘ͢Δ rd_mcp memcpyΛ࢖͏खݎ͍࣮ rd_dr DMAΛ࢖͏଎͍࣮૷
  23. rd_dr/rd_mcp create <ετϨʔδ໊> <αΠζ> /> cd /backstores/rd_mcp /backstores/rd_mcp> create back1

    10M Generating a wwn serial. Created rd_mcp ramdisk back1 with size 10M. /backstores/rd_mcp> ls o- rd_mcp ................................................. [1 Storage Object] o- back1 ............................................. [ramdisk deactivated] /backstores/rd_mcp> createͰ৽͍͠backstoreΛ࡞੒ delete͸fileioͱಉ͡
  24. /> ls! o- / ................................................................... [...]! o- backstores ........................................................ [...]!

    | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> ετϨʔδͷݟͤํ
  25. /> ls! o- / ................................................................... [...]! o- backstores ........................................................ [...]!

    | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> SCSI RDMA Protocol ib_srpt InfinibandʹSCSIϓϩτίϧΛ৐ͤΔ
  26. /> ls! o- / ................................................................... [...]! o- backstores ........................................................ [...]!

    | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> loopback ͜ͷϗετʹ ৽͍͠SCSIσόΠε͕઀ଓ͞ΕͨΑ͏ʹݟ͑Δ
  27. loopback create [<wwn>] createͰ৽͍͠ϧʔϓόοΫλʔήοτΛ࡞੒ /> cd /loopback ! /loopback> create!

    Created target naa.600140589cd08660.! /loopback> ls! o- loopback ....................................................... [1 Target]! o- naa.600140589cd08660 ............................. [naa.6001405cb9de14a5]! o- luns ......................................................... [0 LUNs]! /loopback>
  28. Logical Unit Number ͭͷ4$4*λʔήοτʹ͸ ෳ਺ͷετϨʔδΛͿΒԼ͛Δ͜ͱ͕Ͱ͖Δ /> cd /loopback ! /loopback>

    create! Created target naa.600140589cd08660.! /loopback> ls! o- loopback ....................................................... [1 Target]! o- naa.600140589cd08660 ............................. [naa.6001405cb9de14a5]! o- luns ......................................................... [0 LUNs]! /loopback>
  29. Logical Unit Number LUN0 LUN1 LUN2 LUN3 LUN4 ͍ʹ͑͠ͷύϥϨϧSCSI͸ ετϨʔδΛ਺चͭͳ͗ʹ͢Δ͜ͱ͕Ͱ໊͖ͨ࢒

    SCSIλʔήοτ గਖ਼ൃදதͰ͸-6/͸σΠδʔνΣʔϯͷσόΠεΛࣝผ͢Δͷ ʹ༻͍Δͱ͍ͯ͠·͕ͨ͠ɺͦͷ༻్Ͱ༻͍ΒΕΔͷ͸λʔήοτ *%Ͱ-6/ͱ͸ผ෺Ͱͨ͠ɻ-6/͸୯ҰͷσόΠε͕ෳ਺ͷػೳΛ ఏڙ͍ͯ͠Δ৔߹ʹɺͦΕΒΛࣝผ͢Δҝʹ༻͍ΒΕ·͢
  30. /> cd loopback/naa.600140589cd08660/luns /loopback/naa...9cd08660/luns> create /backstores/fileio/back0 Selected LUN 0. Successfully

    created LUN 0. /loopback/naa...9cd08660/luns> ls o- luns .............................................................. [1 LUN] o- lun0 ..................................... [fileio/back0 (/root/usb.img)] /loopback/naa...9cd08660/luns> Logical Unit Number create <ετϨʔδ໊> [<LUN>] createͰࢦఆͨ͠ετϨʔδͰ৽͍͠LUNΛ࡞੒
  31. /> saveconfig! WARNING: Saving Olivia.localnet current configuration to disk will

    overwrite your boot settings.! The current target configuration will become the default boot config.! Are you sure? Type 'yes': yes ઃఆΛอଘͯ͠λʔήοτ͕ग़དྷ͔ͨݟͯΈΑ͏
  32. ৽͍͠σΟεΫ͕ग़དྷͯΔ $ dmesg! (ུ)! [31290.708141] init_tag_map: adjusted depth to 256!

    [31290.708145] init_tag_map: adjusted depth to 256! [31290.708221] scsi 4:0:1:0: Direct-Access LIO-ORG FILEIO 4.0 PQ: 0 ANSI: 5! [31290.708952] sd 4:0:1:0: [sdb] 204800 512-byte logical blocks: (104 MB/100 MiB)! [31290.709000] sd 4:0:1:0: [sdb] Write Protect is off! [31290.709003] sd 4:0:1:0: [sdb] Mode Sense: 43 00 00 08! [31290.709274] sd 4:0:1:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA! [31290.709519] sdb: unknown partition table! [31290.709679] sd 4:0:1:0: [sdb] Attached SCSI disk
  33. $ mkfs.ext4 /dev/sdb ! mke2fs 1.42.12 (29-Aug-2014)! Creating filesystem with

    102400 1k blocks and 25688 inodes! Filesystem UUID: 58d4ec84-a14a-4b9a-874d-cf3cc1b06331! Superblock backups stored on blocks: ! ! 8193, 24577, 40961, 57345, 73729! ! Allocating group tables: done ! Writing inode tables: done ! Creating journal (4096 blocks): done! Writing superblocks and filesystem accounting information: done ! ! $ mount /dev/sdb /mnt/loop/! $ df -h! ϑΝΠϧγε αΠζ ࢖༻ ࢒Γ ࢖༻% Ϛ΢ϯτҐஔ! (ུ)! /dev/sdb 93M 1.6M 85M 2% /mnt/loop! $ Ϛ΢ϯτͰ͖ΔΑ
  34. /> ls! o- / ................................................................... [...]! o- backstores ........................................................ [...]!

    | o- fileio ............................................. [0 Storage Object]! | o- iblock ............................................. [0 Storage Object]! | o- pscsi .............................................. [0 Storage Object]! | o- rd_dr .............................................. [0 Storage Object]! | o- rd_mcp ............................................. [0 Storage Object]! o- ib_srpt ..................................................... [0 Targets]! o- iscsi ....................................................... [0 Targets]! o- loopback .................................................... [0 Targets]! /> iSCSI TCP/IPωοτϫʔΫʹSCSIϓϩτίϧΛ৐ͤΔ
  35. /> cd iscsi ! /iscsi> create! Created target iqn.2003-01.org.linux-iscsi.olivia.x8664:sn.7bb390f60a12.! Selected

    TPG Tag 1.! Successfully created TPG 1.! /iscsi> ls! o- iscsi .......................................................... [1 Target]! o- iqn.2003-01.org.linux-iscsi.olivia.x8664:sn.7bb390f60a12 ........ [1 TPG]! o- tpgt1 ....................................................... [enabled]! o- acls ....................................................... [0 ACLs]! o- luns ....................................................... [0 LUNs]! o- portals ................................................. [0 Portals]! /iscsi> iSCSI create [<wwn>] createͰ৽͍͠iSCSIλʔήοτΛ࡞੒
  36. /iscsi> cd iqn.2003-01.org.linux-iscsi.olivia.x8664:sn.7bb390f60a12/tpgt1/luns ! /iscsi/iqn.20...12/tpgt1/luns> create /backstores/fileio/back0 ! Selected LUN

    0.! Successfully created LUN 0.! /iscsi/iqn.20...12/tpgt1/luns> ls! o- luns .............................................................. [1 LUN]! o- lun0 ..................................... [fileio/back0 (/root/usb.img)]! /iscsi/iqn.20...12/tpgt1/luns> Logical Unit Number create <ετϨʔδ໊> [<LUN>] createͰࢦఆͨ͠ετϨʔδͰ৽͍͠LUNΛ࡞੒ ͜ͷ෦෼͸loopbackͷ৔߹ͱҰॹ
  37. /iscsi/iqn.20...0f60a12/tpgt1> cd portals ! /iscsi/iqn.20...tpgt1/portals> create 192.168.67.1! Using default IP

    port 3260! Successfully created network portal 192.168.67.1:3260.! /iscsi/iqn.20...tpgt1/portals> ls! o- portals ........................................................ [1 Portal]! o- 192.168.67.1:3260 ................................... [OK, iser disabled]! /iscsi/iqn.20...tpgt1/portals> Portals create <IPΞυϨε> [<ϙʔτ>] ΠχγΤʔλ͔Βͷ઀ଓΛ଴ͪड͚Δ ΞυϨεͱϙʔτΛࢦఆ͢Δ σϑΥϧτͷϙʔτ͸3260൪
  38. /iscsi/iqn.20...12/tpgt1/acls> create iqn.2014-02.localnet.hahnela:openiscsi-5! bdbe8b0c609a2e4c0fa2a056ef7a686! Successfully created Node ACL for iqn.

    2014-02.localnet.hahnela:openiscsi-5bdbe8b0c609a2e4c0fa2a056ef7a686! Created mapped LUN 0.! /iscsi/iqn.20...12/tpgt1/acls> ls! o- acls .............................................................. [1 ACL]! o- iqn.2014-02.localnet.hahnela:openiscsi-5bdbe8b0c609a2e4c0fa2a056ef7a686 [1 Mapped LUN]! o- mapped_lun0 ............................................... [lun0 (rw)]! /iscsi/iqn.20...12/tpgt1/acls> Access Control List create <ΠχγΤʔλͷ໊લ> ϩάΠϯΛڐՄ͢ΔΠχγΤʔλͷϦετ ೝূํ๏΍ύεϫʔυͷઃఆ΋͜͜Ͱ΍Δ
  39. /iscsi/iqn.20...12/tpgt1/acls> cd iqn.2014-02.localnet.hahnela:openiscsi-5bdbe8! b0c609a2e4c0fa2a056ef7a686/! /iscsi/iqn.20...a2a056ef7a686> set auth userid=foobar! Parameter userid

    is now 'foobar'.! /iscsi/iqn.20...a2a056ef7a686> set auth password=hogefuga! Parameter password is now ‘hogefuga'.! /iscsi/iqn.20...a2a056ef7a686> get auth! AUTH CONFIG GROUP! authenticate_target=0 [ro]! The authenticate_target auth_attr.! ! password=hogefuga! The password auth_attr.! ! password_mutual=! The password_mutual auth_attr.! ! userid=foobar! The userid auth_attr.! ! userid_mutual=! The userid_mutual auth_attr. Ϣʔβ໊ͱύεϫʔυΛઃఆ͠Α͏
  40. $ vim /etc/iscsi/iscsi.conf! (ུ)! # *************! # CHAP Settings! #

    *************! ! # To enable CHAP authentication set node.session.auth.authmethod! # to CHAP. The default is None.! node.session.auth.authmethod = CHAP ← CHAPʹΑΔೝূΛ༗ޮʹ͢Δ! # To set a CHAP username and password for initiator! # authentication by the target(s), uncomment the following lines:! node.session.auth.username = foobar ← Ϣʔβ໊! node.session.auth.password = hogefuga ← ύεϫʔυ! ! # To set a CHAP username and password for target(s)! (ུ) ΠχγΤʔλଆʹ΋Ϣʔβ໊ͱύεϫʔυΛઃఆ͠Α͏
  41. $ iscsiadm -m discovery -t st -p 192.168.67.1 -P 1!

    Target: iqn.2003-01.org.linux-iscsi.olivia.x8664:sn.7bb390f60a12! ! Portal: 192.168.67.1:3260,1! ! ! Iface Name: iface0! $ iscsiadm -m node --targetname iqn.2003-01.org.linux-iscsi.olivia.x8664:sn. 7bb390f60a12 --login! Logging in to [iface: iface0, target: iqn.2003-01.org.linux- iscsi.olivia.x8664:sn.7bb390f60a12, portal: 192.168.67.1,3260]! Login to [iface: iface0, target: iqn.2003-01.org.linux-iscsi.olivia.x8664:sn. 7bb390f60a12, portal: 192.168.67.1,3260] successful. ΠχγΤʔλଆ͔Β઀ଓͯ͠ΈΑ͏
  42. [967161.130736] scsi host33: iSCSI Initiator over TCP/IP! [967162.523325] scsi 33:0:0:0:

    Direct-Access LIO-ORG FILEIO 4.0 PQ: 0 ANSI: 5! [967162.720618] sd 33:0:0:0: Attached scsi generic sg2 type 0! [967162.881617] sd 33:0:0:0: [sdc] 204800 512-byte logical blocks: (104 MB/100 MiB)! [967163.263347] sd 33:0:0:0: [sdc] Write Protect is off! [967163.263354] sd 33:0:0:0: [sdc] Mode Sense: 43 00 00 08! [967163.413784] sd 33:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA! [967164.335413] sdc: unknown partition table! [967165.274567] sd 33:0:0:0: [sdc] Attached SCSI disk ৽͍͠σΟεΫ͕ग़དྷͯΔ
  43. ͜ͷଞʹ΋৭Μͳݟͤํ͕ग़དྷΔ 'JCSF$IBOOFM 'JCSF$IBOOFMʹ4$4*ϓϩτίϧΛ৐ͤΔ 'JCSF$IBOOFMPWFS &UIFSOFU '$P&ʹ4$4*ϓϩτίϧΛ৐ͤΔ 'JSF8JSF 'JSF8JSF઀ଓͷσΟεΫʹͳΓ͖Δ *#.W4$4* *#.7JSUVBM*0ʹ4$4*ϓϩτίϧΛ৐ͤΔ

    J4&3 *OpOJCBOEͰ5$1*1௨৴Λ͍ͯ͠Δ৔߹ʹ࢖͑Δ ΑΓޮ཰ͷྑ͍J4$4* 64#(BEHFU 64#઀ଓͷσΟεΫʹͳΓ͖Δ WJSUJP LWNͷήετ؀ڥʹ4$4*σΟεΫΛఏڙ͢Δ
  44. $ /etc/init.d/iscsid start! * Use of the opts variable is

    deprecated and will be! * removed in the future.! * Please use extra_commands, extra_started_commands or extra_stopped_commands.! * Checking open-iSCSI configuration ...! * Loading iSCSI modules ...! * Loading libiscsi ... [ ok ]! * Loading scsi_transport_iscsi ... [ ok ]! * Loading iscsi_tcp ... [ ok ]! * Starting iscsid ...! * Setting up iSCSI targets ...! iscsiadm: No records found! [ !! ]! BeagleBoneBlackͰOpen-iSCSIΛىಈ
  45. $ /etc/init.d/iscsid start! * Use of the opts variable is

    deprecated and will be! * removed in the future.! * Please use extra_commands, extra_started_commands or extra_stopped_commands.! * Checking open-iSCSI configuration ...! * Loading iSCSI modules ...! * Loading libiscsi ... [ ok ]! * Loading scsi_transport_iscsi ... [ ok ]! * Loading iscsi_tcp ... [ ok ]! * Starting iscsid ...! * Setting up iSCSI targets ...! iscsiadm: No records found! [ !! ]! $ iscsiadm -m discovery -t st -p 192.168.152.1 -P1! Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.406262d1b87f! ! Portal: 192.168.152.1:3260,1! ! ! Iface Name: default! Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.f3d75f94ab5f! ! Portal: 192.168.152.1:3260,1! ! ! Iface Name: default! Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.aa5bd06b61e8! ! Portal: 192.168.152.1:3260,1! ! ! Iface Name: default! LIO͕ಈ͍͍ͯΔαʔόʹ઀ଓ
  46. * Please use extra_commands, extra_started_commands or extra_stopped_commands.! * Checking open-iSCSI

    configuration ...! * Loading iSCSI modules ...! * Loading libiscsi ... [ ok ]! * Loading scsi_transport_iscsi ... [ ok ]! * Loading iscsi_tcp ... [ ok ]! * Starting iscsid ...! * Setting up iSCSI targets ...! iscsiadm: No records found! [ !! ]! $ iscsiadm -m discovery -t st -p 192.168.152.1 -P1! Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.406262d1b87f! ! Portal: 192.168.152.1:3260,1! ! ! Iface Name: default! Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.f3d75f94ab5f! ! Portal: 192.168.152.1:3260,1! ! ! Iface Name: default! Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.aa5bd06b61e8! ! Portal: 192.168.152.1:3260,1! ! ! Iface Name: default! $ iscsiadm -m node --targetname iqn.2003-01.org.linux- iscsi.hahnela.x8664:sn.aa5bd06b61e8 --login! Logging in to [iface: default, target: iqn.2003-01.org.linux- iscsi.hahnela.x8664:sn.aa5bd06b61e8, portal: 192.168.152.1,3260]! Login to [iface: default, target: iqn.2003-01.org.linux- iscsi.hahnela.x8664:sn.aa5bd06b61e8, portal: 192.168.152.1,3260] successful.! iSCSIλʔήοτʹϩάΠϯ
  47. ! ! Iface Name: default! Target: iqn.2003-01.org.linux-iscsi.hahnela.x8664:sn.aa5bd06b61e8! ! Portal: 192.168.152.1:3260,1!

    ! ! Iface Name: default! $ iscsiadm -m node --targetname iqn.2003-01.org.linux- iscsi.hahnela.x8664:sn.aa5bd06b61e8 --login! Logging in to [iface: default, target: iqn.2003-01.org.linux- iscsi.hahnela.x8664:sn.aa5bd06b61e8, portal: 192.168.152.1,3260]! Login to [iface: default, target: iqn.2003-01.org.linux- iscsi.hahnela.x8664:sn.aa5bd06b61e8, portal: 192.168.152.1,3260] successful.! $ dmesg|tail! [ 786.904712] iscsid (933): /proc/933/oom_adj is deprecated, please use /proc/ 933/oom_score_adj instead.! [ 865.973831] scsi0 : iSCSI Initiator over TCP/IP! [ 867.037208] scsi 0:0:0:0: Direct-Access LIO-ORG IBLOCK 4.0 PQ: 0 ANSI: 5! [ 867.042950] sd 0:0:0:0: [sda] 41943040 512-byte logical blocks: (21.4 GB/20.0 GiB)! [ 867.042999] sd 0:0:0:0: [sda] 4096-byte physical blocks! [ 867.047639] sd 0:0:0:0: [sda] Write Protect is off! [ 867.047698] sd 0:0:0:0: [sda] Mode Sense: 43 00 10 08! [ 867.049386] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA! [ 867.088748] sda: unknown partition table! [ 867.104140] sd 0:0:0:0: [sda] Attached SCSI disk! /dev/sdaొ৔