FreeBSDなファイルサーバーからexportしたドライブをiSCSIでマウントして、Time Machine用に使う
Macのバックアップ機能Time Machineは、直接USBで接続したHDDを使うのは簡単ですが、NASのようにネットワーク越しのドライブを使用するには小細工が必要なことで有名です。
本エントリでは、ネットワーク越しにFreeBSDなファイルサーバーをiSCSIでマウントできるようにして、これをTime Machineに使ってみます。
- FreeBSD 8.2-RELEASE
- istgt-20110223
Time Machine用にzfs領域(なんて言うんだっけ?)を確保しておきます。
## __GooglePrettify__ # zfs create -o mountpoint=/timemachine tank3/timemachine
ここで、zfsの設定からshareiscsi=onを設定してみても、FreeBSDではサポートされていなくて残念な思いをします。 なので、portsから以下をインストールします。
## __GooglePrettify__ # cd /usr/local/etc/istgt # cp auth.conf.sample auth.conf # cp istgt.conf.sample istgt.conf
istgt.conf を適宜修正。以下では、ファイルサーバーは10.0.1.1, マウントするマックは10.0.4.1です。
## __GooglePrettify__ --- istgt.conf.sample 2011-04-01 02:04:14.638057161 +0900 +++ istgt.conf 2011-04-02 17:14:28.031064416 +0900 @@ -17,7 +17,7 @@ [Global] Comment "Global section" # node name (not include optional part) - NodeBase "iqn.2007-09.jp.ne.peach.istgt" + NodeBase "iqn.2007-09.net.f99aq8ove.istgt" # files PidFile /var/run/istgt.pid @@ -83,7 +83,7 @@ Comment "SINGLE PORT TEST" # Portal Label(not used) IP(IPv6 or IPv4):Port #Portal DA1 [2001:03e0:06cf:0003:021b:21ff:fe04:f405]:3260 - Portal DA1 192.168.2.36:3260 + Portal DA1 10.0.1.1:3260 # wildcard address you may need if use DHCP # DO NOT USE WITH OTHER PORTALS @@ -95,10 +95,10 @@ [InitiatorGroup1] Comment "Initiator Group1" - InitiatorName "iqn.1991-05.com.microsoft:saturn" + # InitiatorName "iqn.1991-05.com.microsoft:saturn" # special word "ALL" match all of initiators - #InitiatorName "ALL" - Netmask 192.168.2.0/24 + InitiatorName "ALL" + Netmask 10.0.4.0/24 # TargetName, Mapping, UnitType, LUN0 are minimum required [LogicalUnit1] @@ -106,13 +106,13 @@ # full specified iqn (same as below) #TargetName iqn.2007-09.jp.ne.peach.istgt:disk1 # short specified non iqn (will add NodeBase) - TargetName disk1 - TargetAlias "Data Disk1" + TargetName timemachine + TargetAlias "Time machine" # use initiators in tag1 via portals in tag1 Mapping PortalGroup1 InitiatorGroup1 # accept both CHAP and None - AuthMethod Auto - AuthGroup AuthGroup1 + AuthMethod None + #AuthGroup AuthGroup1 #UseDigest Header Data UseDigest Auto UnitType Disk @@ -136,7 +136,7 @@ # LogicalVolume for this unit on LUN0 # for file extent - LUN0 Storage /tank/iscsi/istgt-disk1 10GB + LUN0 Storage /timemachine/tm1 200GB # for raw device extent #LUN0 Storage /dev/ad4 Auto # for ZFS volume extent
また、ファイヤーウォールの 3260 tcp/udp を開けておきます。
## __GooglePrettify__ # echo istgt_enable="YES" >> /etc/rc.conf # /usr/local/etc/rc.d/istgt start # /usr/local/etc/rc.d/istgt start
これでサーバー側の設定は完了。次はマック側の設定です。 globalSAN iSCSI initiator for OS Xをインストールします。
環境設定でglobalSANの設定画面を開いてTargetの追加で
Target Name: iqn.2007-09.net.f99aq8ove.istgt:timemachine
でadd
iSCSI Options... -> Always send "SessionType" when connecting. をチェック
そのあとでIPaddrを登録してconnect
初期化するか聞いてくるので初期化して、このディスクをTimeMachineで使うようにして完成
FreeBSDなファイルサーバーからexportしたドライブをiSCSIでマウントして、Time Machine用に使う





