PandoraBox上的时间胶囊

我的 “OpenWRT “是 “PandoraBox”,路由器是 “Mi mini”。
这些都是与官方wiki的一些细微差别。

軟件

System -> Software -> Configuration

将所有的文字调整为:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
src/gz r2_base http://downloads.openwrt.org.cn/PandoraBox/ralink/packages/base
src/gz r2_management http://downloads.openwrt.org.cn/PandoraBox/ralink/packages/management
src/gz r2_oldpackages http://downloads.openwrt.org.cn/PandoraBox/ralink/packages/oldpackages
src/gz r2_packages http://downloads.openwrt.org.cn/PandoraBox/ralink/packages/packages
src/gz r2_routing http://downloads.openwrt.org.cn/PandoraBox/ralink/packages/routing
src/gz r2_telephony http://downloads.openwrt.org.cn/PandoraBox/ralink/packages/telephony

src/gz r2_old_packages http://downloads.openwrt.org.cn/PandoraBox/ralink/mt7620_old/packages/
arch all 100
arch noarch 200
arch ralink 300

然后,ssh 到你的 PandoraBox

1
2
3
4
opkg update
opkg install shadow-useradd shadow-groupadd
cd /usr/lib
ln -s libgcrypt.so.20 libgcrypt.so.11

到您的浏览器

System -> Software -> Actions -> Download and install package

  • netatalk
  • avahi-daemon
  • kmod-usb-storage
  • kmod-fs-hfsplus
  • block-mount

不要像wiki所说的那样尝试 “opkg install”,否则你会得到错误信息。

1
2
3
4
5
Configuring kmod-fs-hfsplus.
//usr/lib/opkg/info/kmod-fs-hfsplus.postinst: .: line 3: can't open '/etc/functions.sh'
Collected errors:
* pkg_run_script: package "kmod-fs-hfsplus" postinst script returned status 2.
* opkg_configure: kmod-fs-hfsplus.postinst returned 2.

Format & Mount

将 BackUp 硬盘插入 Mi mini

blkid找到你的 sda,这是我的

1
/dev/sda3: UUID="dab3d8b8-a87f-3bfb-9fed-f42934d5bcd6" LABEL="BackUp" TYPE="hfsplus" PARTLABEL="Basic data partition" PARTUUID="27db40be-8ebe-11e6-9e2e-60f81da8c0cd"

格式化为 ext4(Mi mini 挂载hfsplus失败,所以我尝试ext4作为交换)

1
mkfs.ext4 /dev/sda3
1
2
3
4
5
6
7
8
9
10
groupadd timemachine
useradd -M -G timemachine tmuser
passwd tmuser
# input the passwd

mkdir /mnt/TimeMachine
chown root:timemachine /mnt/TimeMachine
touch /mnt/TimeMachine/USB_DISK_NOT_PRESENT
chmod 555 /mnt/TimeMachine -R
chmod 444 /mnt/TimeMachine/USB_DISK_NOT_PRESENT

到浏览器

System -> Mount Points -> Mount Points -> Add

Select the UUID you get by blkid mount to /mnt/TimeMachine, remember the size xxx MB, save

You may see /dev/sda3 /mnt/TimeMachine in Mounted file systems

然后到你的 ssh

1
chown -R tmuser:timemachine /mnt/TimeMachine

Netatalk

1
vim /etc/netatalk/afpd.conf

将所有案文改为:

1
"TimeMachine" -uampath /usr/lib/uams -uamlist uams_dhx2.so -nodebug -nouservol -icon -nosavepassword -mimicmodel RackMac
1
vim /etc/netatalk/AppleVolumes.default

将所有文字替换为。(填上你之前得到的 xxx,是 MiB)

1
/mnt/TimeMachine TimeMachine volsizelimit:xxx allow:@timemachine rwlist:@timemachine cnidscheme:dbd options:searchdb,usedots,invisibledots,tm

Avahi

1
vim /etc/avahi/avahi-daemon.conf

将所有案文改为:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[server]
host-name=TimeMachine
#domain-name=local
use-ipv4=yes
use-ipv6=no
check-response-ttl=no
use-iff-running=no
enable-dbus=no
allow-interfaces=br-lan

[publish]
publish-addresses=yes
publish-hinfo=yes
publish-workstation=no
publish-domain=yes
#publish-dns-servers=192.168.1.1
#publish-resolv-conf-dns-servers=yes

[reflector]
enable-reflector=no
reflect-ipv=no

[rlimits]
#rlimit-as=
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=30
rlimit-stack=4194304
rlimit-nproc=3
1
vim /etc/avahi/services/afpd.service

将所有文字替换为:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" standalone="no"?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Time Capsule</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=TimeCapsule</txt-record>
</service>
<service>
<type>_adisk._tcp</type>
<port>9</port>
<txt-record>sys=waMA=XX:XX:XX:XX:XX:XX,adVF=0x100</txt-record>
<txt-record>dk1=adVF=0x83,adVN=TimeMachine</txt-record>
</service>
</service-group>

到您的浏览器

System -> Startup Enable

  • afpd
  • avahi-daemon

重新启动路由器

到 Mac, System Preferences -> Time Machine -> Select Disk -> Available Disks -> on "Time Capsule",你可以看到 TimeMachine