Time Machine is a backup software by Apple, part of macOS allowing easy and foolproof backups.  In a nutshell, it creates incremental backups on a sto

thexhr/openbsd-timemachine

submited by
Style Pass
2023-01-23 08:30:08

Time Machine is a backup software by Apple, part of macOS allowing easy and foolproof backups. In a nutshell, it creates incremental backups on a storage medium of your choice and you can access the data either with a graphical client or directly via file system tools. I especially like that you only have to plug in an external USB drive which is immediately recognized, the backup starts and the drive is unmounted as soon as the backup is done. Since Time Machine is Apple only and I use OpenBSD on all my personal machines, I decided to write my own Time Machine like solution.

At first, we need to manually format the disk and create an encrypted file system on top. Plug in the disk and find the correct device name by looking at the dmesg output:

Since the disk is later controlled by a script we cannot use a passphrase here, we need to store the decryption password in a file. Use the tool of your choice to generate a strong password and store it in a file. To match the passphrase and the disk, name the file after the disks duid (can been seen in disklabel's output above). As last step, set the file's permission to 600 so that only the owner can access it. Otherwise, bioctl complains about wrong permissions.

Leave a Comment