[WayBack1/WayBack2] Memo to self: Ich will ein Time Machine Backup unter Linux mounten, um das “Latest” Verzeichnis mit Restic an Backblaze senden zu können. Schritt 1: Sp… – Kristian Köhntopp – Google+:
Memo to self: Ich will ein Time Machine Backup unter Linux mounten, um das “Latest” Verzeichnis mit Restic an Backblaze senden zu können.
Schritt 1: Sparsebundle mounten
# ls -l /export/tm_kk/
total 8
drwx—— 3 kris users 4096 Oct 21 16:24 KK.sparsebundleGeht mit
# git clone git://github.com/torarnv/sparsebundlefs.git
# cd sparsebundlefs; make
# mkdir -p /bundles/tm_kk
# sparsebundlefs /export/tm_kk/KK.sparsebundle /bundles/tm_kk
# ls -lh /bundles/tm_kk
total 0
-r——– 1 root nogroup 1.5T Oct 21 16:24 sparsebundle.dmgSchritt 2: DMG loopmounten
# fdisk -l /bundles/tm_kk/sparsebundle.dmg
Disk /bundles/tm_kk/sparsebundle.dmg: 1.5 TiB, 1648462135296 bytes, 3219652608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 15FCCBBD-49E4-42BB-B359-EF662F9916CFDevice Start End Sectors Size Type
/bundles/tm_kk/sparsebundle.dmg1 40 409639 409600 200M EFI System
/bundles/tm_kk/sparsebundle.dmg2 409640 3219390423 3218980784 1.5T Apple HFS/HFS+# kpartx -a -v /bundles/tm_kk/sparsebundle.dmg
add map loop8p1 (253:1): 0 409600 linear 7:8 40
add map loop8p2 (253:19): 0 3218980784 linear 7:8 409640# mkdir -p /hfs/tm_kk
# mount -o ro -t hfsplus /dev/mapper/loop8p2 /hfs/tm_kk
# b=$(readlink /hfs/tm_kk/Backups.backupdb/KK/Latest)
# ls -l /hfs/tm_kk/Backups.backupdb/KK/$b
total 0
drwxr-xr-x 1 root root 30 Oct 21 14:26 ‘Macintosh HD’Schritt 3: tmfs mount
Ein Time Machine Backup enthält doofe Hardlinks auf Verzeichnisse. Das kann Linux so nicht, und man muß das noch einmal mit tmfs fusemounten. Seufz.
# apt-get install tmfs
# mkdir -p /tmfs/tm_kk
# tmfs /hfs/tm_kk /tmfs/tm_kk
# ls -l /tmfs/tm_kk/KK/Latest/
total 0
drwxr-xr-x 1 root root 30 Oct 21 14:26 ‘Macintosh HD’Das durchzulesen ist nicht mal langsam.
Schritt 4: Abbauen
# umount /tmfs/tm_kk
# umount /hfs/tm_kk/
# kpartx -d -v /bundles/tm_kk/sparsebundle.dmg
del devmap : loop8p1
del devmap : loop8p2
loop deleted : /dev/loop8
# umount /bundles/tm_kkSchritt 5: Den Mist scripten
…
A few important comments from the WayBack2 link:
Jeroen Wiert Pluimers:
So your time machine data is on a Linux disk that you export from Linux to MacOS? (as otherwise, I don’t understand what /export/tm_kk/KK.sparsebundle is for)
Kristian Köhntopp:
Yes, I am running netatalk, SMB and NFS on an Ubuntu 18.04.
Jeroen Wiert Pluimers:
+Kristian Köhntopp Thanks. What do you envision as steps to restore a complete time machine?
Kristian Köhntopp:
We will see. I do not see that as normally necessary. Mostly I do not want to lose the work on my laptop, and am just to lazy to restrict the backup to that. In general, it should be possible to create this as a writeable setup so that I get the data back. I will probably never recreate a full runnable mac setup from this emergency offsite backup.
Tools used:
- [WayBack] GitHub – torarnv/sparsebundlefs: FUSE filesystem for reading macOS sparse-bundle disk images
- [WayBack] kpartx(8) – Linux man page
- [WayBack] GitHub – abique/tmfs: Apple’s Time Machine fuse read only file system
- [WayBack] restic · Backups done right!
- Backblaze – Wikipedia
- [WayBack] How to Backup Linux With Duplicity and Restic
- [WayBack] How to configure Backblaze B2 with Restic on Linux – Help Desk
- Netatalk – Wikipedia
- Samba (software) – Wikipedia
- Network File System – Wikipedia
–jeroen