Time Capsule on PandoraBox

My “OpenWRT” is “PandoraBox”, and the router is “Mi mini”.
These are slight differences from the official wiki.

Software

System -> Software -> Configuration

Adjust all the text to:

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

Then, SSH to your PandoraBox

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

In your browser

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

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

Do not attempt “opkg install” as described in the wiki, otherwise you will get an error message.

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

Insert the BackUp hard drive into Mi mini

Use blkid to find your sda, this is mine

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

Format it as ext4 (Mi mini fails to mount hfsplus, so I try ext4 as an alternative)

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

In the browser

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

Then in your SSH

1
chown -R tmuser:timemachine /mnt/TimeMachine

Netatalk

1
vim /etc/netatalk/afpd.conf

Change all the text to:

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

Replace all the text with the following (fill in the previous xxx you obtained, it is in 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

Change all the text to:

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

Replace all the text with:

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>

In your browser

System -> Startup Enable

  • afpd
  • avahi-daemon

Restart the router

On your Mac, go to System Preferences -> Time Machine -> Select Disk -> Available Disks -> on "Time Capsule", you should see TimeMachine

Translated by gpt-3.5-turbo