jief666 / hdimount Goto Github PK
View Code? Open in Web Editor NEWMount apple disk image (HFS, APFS, partitioned or not, compressed, encrypted) via Fuse
License: GNU General Public License v3.0
Mount apple disk image (HFS, APFS, partitioned or not, compressed, encrypted) via Fuse
License: GNU General Public License v3.0
The file https://github.com/jief666/hdimount/blob/wip/src/SparsebundleReader.cpp seems to be missing the copyright header from sparsebundlefs
, please add the following at the top of the file:
/*
* Copyright (c) 2012-2016 Tor Arne Vestbø. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Thanks! 😄
Hi!
I tried to mount a encrypted backup.sparsebundle Timemachine Backup in Debian 11 but there are problems receiving the files.
As soon as I cd into the mount-folder I get this:
user@timemachine:/mnt/tm_mount_gcr$ ls -l
ls: cannot access 'Backups.backupdb': No such file or directory
ls: cannot access 'tmbootpicker.efi': No such file or directory
total 0
d????????? ? ? ? ? ? Backups.backupdb
-????????? ? ? ? ? ? tmbootpicker.efi
After some meddling with the code, turning debugging on:
root@timemachine:~# ./hdimount/build_release_linux-gcc-openssl_hdimount/hdimount -f -d /mnt/timemachine/gcr/gcr.sparsebundle /mnt/tm_mount_gcr
Password:
Detected a GPT partionned disk.
Using HFS partition #1 of type Apple_HFS
umount: /mnt/tm_mount_gcr: not mounted.
Hdimount version 1.0__a7e94ff
Everything looks ok. Giving to Fuse
FUSE library version: 2.9.9
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 2, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.32
flags=0x03fffffb
max_readahead=0x00020000
INIT: 7.19
flags=0x00000011
max_readahead=0x00020000
max_write=0x00020000
max_background=0
congestion_threshold=0
unique: 2, success, outsize: 40
unique: 4, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 38726
getattr /
fuse_stat(/) -> stat->mode=41ed
unique: 4, success, outsize: 120
unique: 6, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 38728
getattr /
fuse_stat(/) -> stat->mode=41ed
unique: 6, success, outsize: 120
unique: 8, opcode: ACCESS (34), nodeid: 1, insize: 48, pid: 38059
unique: 8, error: -38 (Function not implemented), outsize: 16
unique: 10, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 38729
unique: 10, success, outsize: 32
unique: 12, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 38729
getattr /
fuse_stat(/) -> stat->mode=41ed
unique: 12, success, outsize: 120
unique: 14, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 38729
readdir[0] from 0
unique: 14, success, outsize: 520
unique: 16, opcode: LOOKUP (1), nodeid: 1, insize: 57, pid: 38729
LOOKUP /Backups.backupdb
getattr /Backups.backupdb
unique: 16, error: -2 (No such file or directory), outsize: 16
unique: 18, opcode: LOOKUP (1), nodeid: 1, insize: 57, pid: 38729
LOOKUP /tmbootpicker.efi
getattr /tmbootpicker.efi
unique: 18, error: -2 (No such file or directory), outsize: 16
unique: 20, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 38729
unique: 20, success, outsize: 16
unique: 22, opcode: RELEASEDIR (29), nodeid: 1, insize: 64, pid: 0
unique: 22, success, outsize: 16
Could someone with a deeper understanding of this guide me to a solution?
Thank You!
I was able to install the DokanSetup.exe from the "msvc" subdir to launch hdimount on Windows.
However, for the same exact DMG file that Linux hdimount can mount correctly, the Windows hdimount is saying "Error: Not encrypted or wrong password."
I think I might've found the issue.
In the Windows version of getpass
, the passLength
is never updated, so it stays at 0 and keeps writing the console input to index 0.
Not only that, but it looks like it never NULL-terminates the string afterward (update: thus the password retains the RETURN
at the end.)
hdimount/src/CrossPlatform.cpp
Line 37 in b1a31ae
if one day more detailed documentaion is created, if not for anybody who attempts to build this project on openSUSE here you are required dependicies:
zypper install gcc-c++ gcc make git libattr-devel fuse-devel libopenssl-1_1-devel zlib-devel
I post it as it differs (different packages names) from Debian/Ubuntu world most people are using
@tomkoen : here is my first version that integrate HFS & APFS disk images, encrypted or clear, sparsebundle or plain files.
I didn't test every single possibility (APF or HSF, encrypted or clear, different compression or not, GPT or Apple map or no map make quite a lot of possibilities), but I checked quite a few.
It's a work in progress branch. There is some cleaning, duplicates...
@LubosD @bugaevc : I can do some pull request if you are interested by some features (encryption, sparsebundle, etc.). Just let me know.
I just noticed there is a build for Debian 9.
Since the project is rather hard to compile, this is very convenient.
Unfortunately that build fails on Debian 10:
hdimount-debian9 "/mnt/timemachine/laptop/Latest/Mac SSD/Users/stefan/stefan.sparsebundle" /mnt/sparsebundle/
Password:
[1] 7509 segmentation fault hdimount-debian9 /mnt/sparsebundle/
Is it possible to provide a build for Debian 10, or an easier build script?
Thanks a lot!
Might be related to #6, but I didn't see xattr in #6.
I have a Linux NAS with an SMB share that I use as Time Machine destination.
Time Machine created an (encrypted) sparsebundle there with the following folder structure:
user@nas:~$ ls -la ~/media/TimeMachine/mac.sparsebundle
total 28
drwx------+ 1 user user 384 Mar 19 2022 .
drwxr-xr-x 1 user users 3148 Apr 3 14:53 ..
drwx------+ 1 user user 4110 Mar 22 2022 bands
-rw-r--r--+ 1 user user 516 Mar 22 2022 com.apple.TimeMachine.MachineID.bckup
-rw-r--r--+ 1 user user 516 Mar 22 2022 com.apple.TimeMachine.MachineID.plist
-rw-r--r--+ 1 user user 1374 Mar 22 2022 com.apple.TimeMachine.Results.plist
-rw-r--r--+ 1 user user 2440 Mar 22 2022 com.apple.TimeMachine.SnapshotHistory.plist
-rw-r--r--+ 1 user user 503 Mar 19 2022 Info.bckup
-rw-r--r--+ 1 user user 503 Mar 19 2022 Info.plist
-rw-------+ 1 user user 0 Mar 8 2022 lock
drwx------+ 1 user user 4110 Mar 22 2022 mapped
-rwx------+ 1 user user 122368 Mar 8 2022 token
Mounting this sparsebundle with hdimount
, then using ls -l
on the mountpoint I'm getting a bunch of No such file or directory
messages from ls
:
user@nas:~/mnt$ ls -l hdi/
ls: hdi/: No such file or directory
ls: hdi/backup_manifest.plist: No such file or directory
ls: hdi/2022-03-22-054702.previous: No such file or directory
total 8
drwxr-xr-x 6 root root 192 Mar 22 2022 2022-03-22-054702.previous
-rw-r--r-- 1 root root 7831 Mar 22 2022 backup_manifest.plist
Looking at the fuse debug logs I can see the No such file or directory
errors are relating to getxattr
calls:
user@nas:~/mnt$ hdimount -f -d ~/media/TimeMachine/mac.sparsebundle hdi
Password:
FUSE library version: 2.9.9
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 2, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.32
flags=0x03fffffb
max_readahead=0x00020000
INIT: 7.19
flags=0x00000011
max_readahead=0x00020000
max_write=0x00020000
max_background=0
congestion_threshold=0
unique: 2, success, outsize: 40
unique: 4, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 1840356
getattr /
unique: 4, success, outsize: 120
unique: 6, opcode: GETXATTR (22), nodeid: 1, insize: 65, pid: 1840356
getxattr / security.selinux 255
unique: 6, error: -2 (No such file or directory), outsize: 16
unique: 8, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 1840356
unique: 8, success, outsize: 32
unique: 10, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 1840356
readdir[0] from 0
unique: 10, success, outsize: 280
unique: 12, opcode: LOOKUP (1), nodeid: 1, insize: 62, pid: 1840356
LOOKUP /backup_manifest.plist
getattr /backup_manifest.plist
NODEID: 2
unique: 12, success, outsize: 144
unique: 14, opcode: GETXATTR (22), nodeid: 2, insize: 65, pid: 1840356
getxattr /backup_manifest.plist security.selinux 255
unique: 14, error: -2 (No such file or directory), outsize: 16
unique: 16, opcode: LOOKUP (1), nodeid: 1, insize: 67, pid: 1840356
LOOKUP /2022-03-22-054702.previous
getattr /2022-03-22-054702.previous
NODEID: 3
unique: 16, success, outsize: 144
unique: 18, opcode: GETXATTR (22), nodeid: 3, insize: 65, pid: 1840356
getxattr /2022-03-22-054702.previous security.selinux 255
unique: 18, error: -2 (No such file or directory), outsize: 16
unique: 20, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 1840356
unique: 20, success, outsize: 16
unique: 22, opcode: RELEASEDIR (29), nodeid: 1, insize: 64, pid: 0
unique: 22, success, outsize: 16
@jief666, are you currently able to get the wip
branch to compile? I'm assuming fuse.cpp
is the main executable. I'm attempting to compile on Linux x86_64 and am running into some dependency issues that make me wonder if it was intended for compilation on macOS, which doesn't make sense to me since the tool's purpose is to open encrypted sparsebundle files on Linux.
it is rather FYI and anybody who tries to build it:
it failes as there is no attr/xattr.h on openSUSE (neither on Red Hat nor Centos).
FIX:
in ./hdimount/src/HfsFuseVolume.cpp
I had to replace:
#ifdef __APPLE__
# include <sys/xattr.h> // for ENOATTR
#elif defined(_MSC_VER)
# define ENOATTR (93) // TODO better ?
#else
# include <attr/xattr.h> // for ENOATTR
#endif
with:
#include <sys/xattr.h> // for ENOATTR
#define ENOATTR (93)
then it compiles and works no issue.
I guess it will be the same with Fedora.
Dokany has moved to version 2.x and does not have required dokanyfuse1.dll anymore. It is now dokanyfuse2.dll.
Thank you for making this! It works great with lzfse, unlike darling-dmg.
Do you have a list of requirements, and ideally also a makefile? I am eager to contribute, but am currently unable to compile it.
Attempting to mount an old HFS Standard CD-ROM (Macintosh software) I get:
$ ./hdimount-osx13 "CD.iso" /Volumes/HFS
Password:
Error: Unsupported file format
Could this be due to recent (Catalina) changes in macOS (retirement of HFS Standard support), or does Fuse in hdimount
work around that?
Using other tools https://www.mars.org/home/rob/proj/hfs/ I can demonstrate that my disk image contains a valid HFS partition.
$ hmount "CD.iso"
/Users/matt/Desktop/CD.iso: contains 1 HFS partition
Volume name is "MacCD"
Volume was created on Mon Sep 5 10:40:25 1994
Volume was last modified on Mon Oct 3 16:49:00 1994
Volume has 12513280 bytes free
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.