VMWareの中で実験してみる。
IP 構成
hast-a 192.168.68.198 hast-b 192.168.68.199 vip 192.168.68.200
リソース構成
hdd /dev/ad0 (OS 8G) /dev/ad1 hasthd1(/dev/hast/hasthd1)
hasthd1をistgtでエクスポートして外部から使いたい。
FreeBSD-8.1を最小インストールして、
以下パッケージを追加
compat6x-i386-6.4.604000.200810_3 A convenience package to install the compat6x libraries istgt-20100525 An iSCSI target for FreeBSD 7.x perl-5.10.1_1 Practical Extraction and Report Language ucarp-1.5.2 Userlevel Common Address Redundancy Protocol
hast-aのrc.conf
hostname="hast-a" ifconfig_em0="inet 192.168.68.198 netmask 255.255.255.0" defaultrouter="192.168.68.2" keymap="jp.106" sshd_enable="YES" sendmail_enable="NONE"
hast-b は hostname ,ipが違うだけ
/etc/hast.conf
resource hasthd1 { on hast-a { local /dev/ad1 remote 192.168.68.199 } on hast-b { local /dev/ad1 remote 192.168.68.198 } }
これはどっちもいっしょ
HAST - FreeBSD Wikiを参照してhastd起動
hast-a#hastctl create hasthd1 hast-a#hastd hast-b#hastctl create hasthd1 hast-b#hastd hast-a#hastctl role primary hasthd1 hast-b#hastctl role secondary hasthd1
その後hast-bで変なエラーがでた。
hast-b hastd: [hasthd1] (init) We act as init for the resource and not as secondary as requested by tcp4://192.168.68.198:44697. hast-b hastd: [hasthd1] (init) We act as init for the resource and not as secondary as requested by tcp4://192.168.68.198:36413. hast-b hastd: [hasthd1] (init) We act as init for the resource and not as secondary as requested by tcp4://192.168.68.198:17581.
最初はdirtyがいっぱいあったけど同期した?
hast-a# hastctl status hasthd1: role: primary provname: hasthd1 localpath: /dev/ad1 extentsize: 2097152 keepdirty: 64 remoteaddr: 192.168.68.199 replication: memsync status: complete dirty: 0 bytes hast-b# hastctl status hasthd1: role: secondary provname: hasthd1 localpath: /dev/ad1 extentsize: 2097152 keepdirty: 0 remoteaddr: 192.168.68.198 replication: memsync status: complete dirty: 0 bytes
istgtでエクスポートしてみる。設定変更部分はこんな感じだった。
Portal DA1 0.0.0.0:3260 InitiatorName "ALL" Netmask 192.168.68.0/24 LUN0 Storage /dev/hast/hasthd1 Auto
起動してみる。
hast-a# /usr/local/etc/rc.d/istgt onestart Starting istgt. istgt version 0.3 (20100525) LU1 HDD UNIT LU1: LUN0 file=/dev/hast/hasthd1, size=8589929984 LU1: LUN0 16777207 blocks, 512 bytes/block LU1: LUN0 7.9GB storage for iqn.2007-09.jp.ne.peach.istgt:disk1 LU1: LUN0 command queuing disabled
VMWareホストのWindowsからマウントしてフォーマットしてみたが、
a,bともにアクセスしてるんで同期はしてるぽい。
あとはucarpと連携部分かな。