# dd if=/dev/zero of=/dev/ada2 bs=1m count=1 # dd if=/dev/zero of=/dev/ada3 bs=1m count=1 # dd if=/dev/zero of=/dev/ada4 bs=1m count=1 # dd if=/dev/zero of=/dev/ada5 bs=1m count=1 # gpart create -s gpt ada2 # gpart create -s gpt ada3 # gpart create -s gpt ada4 # gpart create -s gpt ada5 # gpart add -b 40 -s 3906721895 -t freebsd-zfs -l data0a ada2 # gpart add -b 40 -s 3906721895 -t freebsd-zfs -l data0b ada3 # gpart add -b 40 -s 3906721895 -t freebsd-zfs -l data0c ada4 # gpart add -b 40 -s 3906721895 -t freebsd-zfs -l data0d ada5 # gnop create -S 4096 /dev/ada2p2 # gnop create -S 4096 /dev/ada3p2 # gnop create -S 4096 /dev/ada4p2 # gnop create -S 4096 /dev/ada5p2 # zpool create zdata raidz /dev/ada2p1.nop /dev/ada3p1.nop /dev/ada4p1.nop /dev/ada5p1.nop # zpool export zdata # gnop destroy /dev/ada2p2.nop # gnop destroy /dev/ada3p2.nop # gnop destroy /dev/ada4p2.nop # gnop destroy /dev/ada5p2.nop # zpool import zdata # zfs set checksum=fletcher4 zdata # zfs set compression=on zdata # zfs create -o normalization=formC zdata/NFC # zfs create -o compression=gzip-9 zdata/NFC/backup # zfs create -o quota=3T zdata/NFC/backup/TimeMachine # TimeMachine用バックアップ領域 # zfs create -o quota=2T zdata/NFC/backup/self # サーバ自身用バックアップ領域 # zfs create zdata/NFC/data # データ領域
Macの/Volumesを真似ねたディレクトリを掘り、シンボリックリンクを張る際はそこを基準にするととサーバ・Macの両方から使えるリンクになる。
$ sudo mkdir /Volumes $ sudo chmod 777 /Volumes $ sudo ln -s /zdata/NFC/data /Volumes/Data $ sudo ln -s /zdata/NFC/backup/TimeMachine /Volumes/TimeMachine
$ sudo portinstall avahi
<?xml version="1.0" standalone='no'?> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h</name> <service> <type>_adisk._tcp</type> <port>9</port> <txt-record>sys=adVF=0x100</txt-record> <txt-record>dk0=adVN=Time Machine,adVF=0x81</txt-record> </service> </service-group> </xterm>
dbus_enable="YES" avahi_daemon_enable="YES"
$ sudo /usr/local/etc/rc.d/dbus start $ sudo /usr/local/etc/rc.d/avahi-daemon start
$ sudo portinstall netatalk
ATALK_NAME=Freyja ATALK_UNIX_CHARSET='UTF8' ATALK_MAC_CHARSET='MAC_JAPANESE' AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so" CNID_CONFIG="-l LOG_NOTE -f /var/log/netatalk.log"
:DEFAULT: options:upriv,usedots dperm:0700 fperm:0600 ~ /Volumes/Data "Data" /Volumes/TimeMachine "Time Machine" options:tm
netatalk_enable="YES" cnid_metad_enable="YES" afpd_enable="YES"
$ sudo /usr/local/etc/rc.d/avahi-daemon start