-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DeepDive] Apple Time Machine backups (sparsebundle, backupdb, etc) #89
Comments
The following are my notes on copying a networked Time Machine backup from my NAS to a locally attached external hard disk, then (working on the local copy so as not to damage the original backup) attempting to reduce the size of the Copy Time Machine backup
|
Thanks @0xdevalias for this info about TM. I have two images of the same TM bakup, one with extension .backupbundle (>1TB) and another with the extension .sparesebundle (12GB). Neither one of them can mount unfortunately (from macos Catalina). I suspect this situation happened while upgrading to Catalina and in that process the TM process was interupted for an unknown reason. The NAS was not feeling well probably... Based on a post in Apple support, some users have solved it by renaming externsion .backupbundle into .sparsebundle, and then it worked. However, I suspect that they hade only the .backupbundle image and not the .sparebundle. Any ideas are most welcome. |
This seems like a good place to post: I just successfully resized a time machine volume hosted on an SMB share backed by ZFS. I increased the quota on the ZFS volume, but in order to get the extra space to show up, I had to extend the backupbundle.
|
Why can't I delete files from an APFS Time Machine backup on macOS Ventura?Seems the normal ways of deleting a file from all TimeMachine backups no longer exists/works under macOS Ventura / when using APFS for backups?
And as a bonus link, how to exclude things from being backed up in the first place:
|
Regarding band size for TM .sparsebundle on NAS... With no modifications, my TM band size on a NAS volume defaulted to 256MB. For reference: |
@cognivator Interesting.. Thanks for sharing! I'll have to get around to creating a new NAS backup from macOS Ventura sometime and see what it defaults to for me! |
Note: the methods listed in the original article may not be the best/most up to date methods anymore.
In particular, I located another method using
tmutil restore
at the following link:There's also a lot of useful info about
tmutil
's capabilities at the following link:If you're wanting to 'Transfer Time Machine back-ups from one back-up disc to another':
With Parallels we can create a new macOS virtual machine (VM), and then potentially we could 'restore' a TimeMachine backup to that VM:
And while it's not TimeMachine related, I recently discovered SuperDuper and how it can make bootable macOS backups, which could be a useful thing (potentially combined with restoring from an old TimeMachine backup, then creating a bootable backup from that?):
Some more useful blog posts related to sparsebundles and similar:
Hacky ways to speed up initial Time Machine backup on NAS
There are a few tricks/hacks/workaround for creating a local TimeMachine backup, which can then be transferred to a NAS, and used for a networked TimeMachine backup.
Both of these seem to be kind of hacky workarounds for ways to get an appropriate
sparsebundle
created, using that locally to perform the first backup with TimeMachine, then moving it to a NAS/server to continue making future backups over the network. Therefore.. it may just be more useful to manually create thesparsebundle
image ourself (see below).Manually creating a
sparsebundle
disk imageI added some notes on manually creating
.sparsebundle
disk images, which could potentially be used to 'coerce' Time Machine into not directly creating a.backupdb
file when backing up to an external hard disk:Which links to the following references:
Some other resources I found with regards to manually creating
sparsebundle
images, particularly from the command line:hdiutil create -library SPUD -size $SIZESPEC -fs Journaled HFS+ -type SPARSEBUNDLE -volname $MACHINENAME_$MAC_ADDRESS.sparsebundle
hdiutil create -size 320g -type SPARSEBUNDLE -fs "HFS+J" MacBook-Backup.sparsebundle open MacBook-Backup.sparsebundle
diskutil list
sudo diskutil enableOwnership /dev/disk2s2
sudo tmutil setdestination '/Volumes/MacBook Pro Backup'
hdiutil create -size 900g -type SPARSEBUNDLE -nospotlight -volname "Backup of $MACHINE_NAME" -fs "Case-sensitive Journaled HFS+" -imagekey sparse-band-size=262144 -verbose ./$MACHINE_NAME.sparsebundle
cp your-machine-name.old.sparsebundle/com.apple.TimeMachine.*.plist your-machine-name.new.sparsebundle
hdiutil create -library SPUD -size $SIZESPEC -fs HFS+J -type SPARSEBUNDLE \ -tgtimagekey sparse-band-size=262144 -volname "Backup of $MACHINENAME" \ $MACHINENAME_$MAC.sparsebundle
hdiutil create -size 500g -type SPARSEBUNDLE -encryption AES-128 -nospotlight -fs "Journaled HFS+" -volname "$TC" $HN\_$MA.sparsebundle
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
If using the command line and low level tools like
hdiutil
isn't your thing, Spundle appears to be a GUI tool that wraps up some of the more commonly neededsparsebundle
related features:Copy
.sparsebundle
from NAS to local/external diskNote: if you're copying over the internet/a slower network, you may benefit from adding
-z
to thersync
command to enable compression.To ensure your destination doesn't keep any files that no longer exist on the source, make sure to use
--delete
(though be careful when doing so, as you could accidentally remove all your destination files if you make a mistake.. maybe combine with--dry-run
to see what will be changed first):You can use
--dry-run
to see what files have changed/need to be synced without actually sending them, and--itemize-changes
to see why those files are considered to have been changed:Deleting files from Time Machine backups
sudo bypass rm -f */Macintosh\ HD/Users/csm/vm.img
/System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass
find . -samefile /path/to/file
find /mount/point -xdev -inum 12353538
du -csh */foodisk/Users/devalias/VMs/**/*.vmem
*.vmem
file, as well as the total size of all files listedfind ./hourly.2 -type f -links 1 -printf "%s\n" | awk '{s=s+$1} END {print s}'
hourly.2
which have only one linkdu -csh dirA dirB
du -ch --max-depth=1 parent/
Reclaim space by defragging / compacting
sparsebundle
'sIt appears there is also some good information about using
hdiutil
to compact sparsebundles to reclaim unused space, and some tricks for using it to 'defrag' the bundle (and ideally save even more space):hdiutil compact
hdiutil convert
hdiutil imageinfo mycomputer.sparsebundle
Time Machine changes in macOS Big Sur
DIY Docker / Raspberry Pi / etc Time Machine (Time Capsule)
sudo apt-get install hfsutils hfsprogs
sudo mkfs.hfsplus /dev/sda2 -v TimeMachine
docker pull mbentley/timemachine:smb
tmutil
Some useful
tmutil
subcommands (fromman tmutil
) for comparing/extracting files from backups, as well as managing backup files:hdiutil
Unsorted
tar
can be used to create an archive that preserves (includes) hardlinks.tar
file, using--verbose
then we can see file attributes.tar
file to give us just the 'diff'/delta of that backup (files changed), without including all of the previous files.tar -f archive.tar --delete test2.txt
The text was updated successfully, but these errors were encountered: