Current revision: 0.4
Last update: 2018-04-11 10:34:28 +0300 UTC
Tact is the art of making a point without making an enemy.
I am big fun of backups. One of the first things I do when I get a new machine is set up the backup scheme.
My fleet consists mainly of Apple hardware. I like Apple’s TimeMachine. TM is visually pleasant and has saved me quite a few times in the past.
Sometimes TimeMachine doesn’t calculate the available space in the ZFS remote partition properly and fills up the disk. The fact that my backups are hosted in a remote Linux server, mounted via Netatalk (AFPd), must have a lot to do with this. The iMac backup ZFS filesystem is 1TB, but TM was displaying 1.3TB of available space.
When this happens, instead of automatically deleting old backups, TM keeps complaining about not being able to continue with this backup. To fix this, I had to delete the backups manually. First, I had to increase the capacity of the ZFS partition a bit in order to be able to work with it without issues. This is straight forward:
# zfs set quota=1124G storage/tm_imac
Then I had to disable automated backups on the mac:
$ sudo tmutil disable
To check available backups:
$ sudo tmutil listbackups
This command will give you the full path and dates to the respective backups. I wanted to delete the first 15, so I wrote a simple bash script to do the work for me:
#!/usr/bin/env bash n=15 tmutil listbackups | head -n $n | while read f do sudo tmutil delete "$f" done
The last step is compact the sparsebundle, otherwise the sparsebundle’s size will remain unchanged. When I mounted the remote directory via Netatalk (AFPd), the system complained about used resources, even though
lsof didn’t reveal much. I mounted the remote directory via sshfs and then compacted the sparsebundle:
$ hdiutil compact archimedes.sparsebundle
Compaction released approximately 300 GB of HD space. I had to resize the ZFS backup partition, setting the quota to 1024G again and enabled time machine backups. A quick check on the TM settings revealed that TM was reading the backup dir size properly now.