Hacker News new | ask | show | jobs
by snapetom 2096 days ago
Thanks for the warning about TM to NAS. Out of curiosity, were you using HFS+ and AFP via hfsprogs and Netatalk?

I set up a Pi4 with an external drive attached to it via USB3 about a year ago. I wanted to set up a solution for me and my wife's Macs. There's plenty of "tutorials" out there and found there were all pretty much the same - HFS+ and AFP. If you follow them, they work great - for a few days.

Eventually all my Macs (Mojave and Catalina) would get a Time Machine error saying the backup was corrupted and would have to build a new version. This happened a couple of times, and eventually tried using SMB. That made the problem go away. All great, so I thought.

Then, any time I had a power outage, the whole file system on the drive would get corrupted. They could only be mounted as read only, and no amount of fsck fixed it. Switching from HFS+ to ext4 fixed that issue.

Things have been pretty reliable since then. I've been able to recover a few files here and there, but haven't had to fully recover from a disaster.

TL;DR - every blog that tells you to create a TM machine/Pi backup using hfsprogs and Netatalk is wrong. Don't do it that way. Use smb and ext4

3 comments

That’s bizarre, I have no idea why anyone would recommend HFS+ for that. It’s a Linux system running Netatalk, which uses normal POSIX file I/O. ext4 is a far better choice.

Cargo-cult HOWTOs is the only explanation I can think of.

> Cargo-cult HOWTOs is the only explanation I can think of.

Pretty much. When I google "raspberry Pi time machine," every result I see, except one, tells you to do the HFS+/AFP method. These results include content churning sites like techradar and howtogeek.

The only site that recommends ext4/smb that comes up, fourth on my list of results, is this one: https://mudge.name/2019/11/12/using-a-raspberry-pi-for-time-...

netatalk is also the wrong solution nowadays. AFP is unmaintained, both on the netatalk side and on macOS. Instead, Samba supports Time Machine backups via the "fruit" (!) extension, which also provides some nice performance improvements for macOS clients.

https://manpages.debian.org/buster/samba-vfs-modules/vfs_fru...

TL;DR though: add the following configuration to the global section of your smb.conf:

    vfs objects = fruit streams_xattr
    fruit:aapl = yes
    fruit:metadata = netatalk
And under the section for your Time Machine share:

    fruit:time machine = yes
SMB on ZFS also works excellently, 4 years and counting with many power losses, ungraceful ejections, etc. never a corrupted backup.
Interesting. I have a backup using Netatalk, but on ext4. Are you saying a simple samba share should work just fine?
Out of curiosity, how long has it been since you switched to ext4?
6 months. 3 power failures in the meantime and remounting has been flawless.