好久之后写的第一篇文章。
mac空间满了于是直接格式化掉了重置了,文件备份还在nas里,于是想直接给取出来。
0x01 编译安装
这里我们要用到两个binary,分别是‣,用来把sparsebundle挂在成一个dmg,以及‣,用来把dmg里的APFS备份卷挂载出来。
但是似乎这两个都没有现成的包可以用,于是我们需要手动安装。
首先安装依赖
Bash
然后找源码/编译:
Bash
git clone --depth=1 https://github.com/torarnv/sparsebundlefs.gitcd sparsebundlefssudo make installcd ..git clone --depth=1 https://github.com/sgan81/apfs-fuse.gitcd apfs-fusegit submodule init # ?这里是不是能直接用--recusive了?git submodule updatemkdir buildcd buildcmake ..sudo make install cd ..0x02 挂载
首先你需要找到nas上用来存放sparsebundle的地方,我用的是飞牛所以是在/vol1/@timemachine 下面。
Bash
mkdir -p "mnt_sparsebundle" "mnt_apfs"sparsebundlefs /vol1/@timemachine/HUAWEI\ Matebook\ Pro.sparsebundle ./mnt_sparsebundlels -l mnt_sparsebundle这个时候能看到这里面有一个sparsebundle.dmg ,接下来用apfs-fuse来挂载sparsebundle.dmg
Bash
apfs-fuse ./mnt_sparsebundle/sparsebundle.dmg ./mnt_apfs这个时候就能在./mnt_apfs/root下面看到
Bash
- `2026-04-03-094221.previous`- `2026-04-03-094221.backup`- `backup_manifest.plist`这样的几个备份了,进去看看也能找到正确的文件。
0x03 切换特定快照
其实也可以只挂在某一个快照。需要用apfsutil查看Snapshots。
Bash
apfs-fuse \ -o snap=1769 \ "./mnt_sparsebundle/sparsebundle.dmg" \ "./mnt_apfs"最后找到文件,用rsync或者cp直接取出来就好。