One Good Turn: A Retired Datto Becomes My Backup Box
RAID is not a backup. Everybody says it. I’ve said it to clients. And for months, every byte that mattered in my house lived on one server.
NAStalgia has 24 drives, four RAIDZ2 vdevs, and a pool layout I’m still a little smug about. It can lose a whole enclosure and keep serving movies. What it can’t survive is me fat-fingering a zfs destroy, a bad update, ransomware, or a power surge that takes out the whole box. Redundancy protects you from hardware. Backups protect you from everything else, including yourself.
One good turn deserves another.
I had a retired backup appliance and a shelf full of old drives. So, a backup box.
The box
The donor is a Datto ALTO XL, a little 4-bay backup appliance of the kind Datto sells to MSPs. It still had an old FreeNAS install on its boot SSD, so apparently past me had plans for it too. Past me did not follow through.
The specs, such as they are:
- 4 drive bays. That’s the hard cap, and it shaped every decision after this.
- 60 GB SSD for the OS, mounted on the front plate.
- 8 GB of DDR3 (two 4 GB sticks, non-ECC). That happens to be exactly TrueNAS’s minimum. Lucky.
- A dead CMOS battery. The clock was six hours slow. It’s one of those shrink-wrapped batteries with wires soldered to leads on the board, so I’m not replacing it. NTP will be fine.
I opened it up to clean it, and it was really filled with crud. The CPU fan especially. Put it back together, hit the power button, and…
It boot-looped. Fans spin up, drives spin up, heads seek, then it shuts off and does it again. Forever.
A DIMM had come unseated when I reinstalled the motherboard. Reseated it, and we had life. If you ever open one of these up and it starts looping, check the RAM first.
The drive inventory
My first plan was four 3 TB drives. Then I actually counted, and I had exactly four. Building a pool with no same-size spare is asking for trouble.
What I did have was about ten 2 TB drives and six 8 TB drives. So:
- Now: four 2 TB drives, with the rest as cold spares on the shelf.
- Later: swap in the 8 TB drives one at a time and let ZFS grow the pool. A vdev only gets bigger once every drive in it has been replaced, so with four bays, four 8 TBs gets the whole thing.
I have a problem, and that problem is drives.
Before any of them went near a pool, every drive got tortured.
Burn-in
The first round was badblocks in destructive write mode on every disk at once, each in its own tmux window, plus dd from /dev/urandom to /dev/null to heat up the CPU and test that newly-cleaned fan.
The full four-pattern test on a 2 TB drive takes a day and a half or more. After about 23 hours, I decided that was enough torture. No bad blocks found. For the next batch, I dropped to one random pattern, which is one full write pass and one full read pass:
for d in 0 1 2 3; do smartctl -i -A /dev/ada$d > /root/ada$d.before; done
badblocks -b 4096 -wsv -t random /dev/adaX
Save the SMART data before, compare it after. A drive that passes badblocks but whose reallocated sector count climbed during the test is still a drive to bench.
Then I got a little carried away and ran badblocks on every hard drive in the house. The bad ones went in the trash. That included one 2 TB that SMART flagged before I even started (over 1,300 unreadable sectors), and two of my six 8 TB drives.
So now I have exactly four 8 TBs for the future upgrade, and no 8 TB cold spare after that. Noted. Filed under “future Dan’s problem.”
The four pool drives are WD Re 2 TB enterprise drives: 7200 RPM, CMR, nothing exotic. I checked every model number for SMR before burn-in, because SMR drives and ZFS resilvers do not get along. One wrinkle: three of the four were made on the same day in 2015. Drives from the same batch tend to fail around the same time. The spares are from that same batch too, so there’s no real way around it. It’s a backup copy. I can live with it.
RAIDZ1 or RAIDZ2?
This was the real decision, because parity can’t be changed later. Whatever I pick now, the 8 TB pool inherits.
| Layout | Usable now | Usable after 8 TB swap | Survives |
|---|---|---|---|
| RAIDZ1 | ~5.1 TiB | ~20.5 TiB | 1 drive failure |
| RAIDZ2 | ~3.4 TiB | ~13.7 TiB | 2 drive failures |
Claude recommended RAIDZ2 on drives this old. I went RAIDZ1.
My reasoning: this box holds copies. NAStalgia holds the originals with plenty of redundancy of its own. If truebak loses two drives at once, I haven’t lost anything except an afternoon of re-replicating. That trade buys me 7 TiB more space once the upgrade’s done.
There was one more free SATA port on the board, which would let me add each new 8 TB drive alongside the old one, so the pool never runs degraded during a swap. Unfortunately, no power connector for it. I have external SATA power, but it’s not worth the hassle for a simple backup box. Each swap will run without redundancy until it finishes resilvering. Again: it’s a copy.
TrueNAS, again
With 8 GB of RAM I briefly considered plain Debian with ZFS and sanoid/syncoid. Lighter, more control. But then alerts, replication monitoring, and everything else become scripts I have to maintain. NAStalgia already runs TrueNAS, so replication between the two is point-and-click on both ends. Easy call.
The box is truebak. The pool is bak. I’m very creative.
I installed the 27.0 release candidate. On purpose. Yes, I know what I said last time about choosing stable over shiny.
The one thing to stay on top of: NAStalgia runs an older release. If I ever need to send data back the other way, newer ZFS features on the backup pool could keep the older system from accepting it. So the bak pool’s feature flags stay un-upgraded until NAStalgia catches up. When TrueNAS offers to upgrade the pool, the answer is no.
Alerts go to Telegram, same bot as NAStalgia. Native setting, no scripts.
Replication, and a Thanksgiving morning bug
The plan for NAStalgia’s important stuff:
- Daily recursive snapshots of Plex’s appdata and all the VM disks, kept 8 weeks.
- A push replication task over SSH to
bak/nastalgia, set read-only on the receiving end, nightly at midnight. - Skip the junk. The downloads volume was 401 GB, and 267 GB of that was old snapshots. All of it can be downloaded again. Skipped. There’s also an older copy of the Plex appdata sitting on the VM pool that would have been backed up twice. Skipped.
All in, about a terabyte. The first run failed immediately:
not enough values to unpack (expected 4, got 1)
That’s Python complaining, not ZFS. The replication engine runs zfs commands on the remote box over SSH, then splits every line of output on tabs, expecting exactly four fields. Something on truebak was sending back a line with no tabs in it.
The forum answers all pointed the same direction: the SSH user can’t run zfs without a sudo password, or its login shell prints junk. Reasonable. Also not the problem. Passwordless sudo for zfs was already set up, and the shell was clean.
It took running the command by hand on truebak, the morning of Thanksgiving, to see the actual culprit:
sudo: unable to resolve host truebak: Name or service not known
Every time sudo ran, it printed that warning first. One line, no tabs, replication dead. The box didn’t know its own name. Once the hostname resolved properly, sudo shut up and the replication ran clean. Initial sync kicked off before I left for Thanksgiving dinner.
The forum answer is usually the right answer. “Usually” is doing a lot of work in that sentence.
Letting it sleep
The box does its work in about an hour every night. The other 23 hours, the drives can spin down. Four 7200 RPM drives idling all day add up, and I don’t know if you’ve seen electricity prices in Massachusetts, but ouch.
Setting a standby timer isn’t enough on its own, though. A few things had to change:
- Move the system dataset to the boot SSD. TrueNAS keeps logs, reporting data, and its config database on the system dataset. If that lives on the data pool, something writes to the disks every few minutes and they never sleep. This is the big one.
- HDD standby: 60 minutes. Not shorter. The replication can pause and restart, and a short timer means several spin-ups a night.
- Leave APM off. Advanced Power Management controls head parking, not standby. On enterprise drives it’s either ignored or it wears out the heads.
Then check that it actually works:
smartctl -n standby -i /dev/disk/by-id/<drive>
If the drive is asleep, that command says so and exits without waking it up. Mine are asleep. The estimate is 25 to 30 watts saved, or very roughly $50 to $80 a year. That’s an estimate, not a measurement, but it’ll do.
Skipping SMART tests
This is my call, and I’ll defend it. Every SMART test wakes the drives. Instead, there’s a weekly scrub, Sundays at 2 AM.
A scrub reads every block that holds data. A resilver needs exactly those same blocks. So the scrub tests what a rebuild actually depends on, and it alerts me when something’s wrong. What I give up is early warning: a long SMART test also reads the empty parts of the disk, and bad sector counts often start climbing before a scrub ever finds an error.
On a primary server, I’d run both. On a backup copy, scrubs will alert when I need them to.
Backing up the laptop
My laptop’s home directory goes to truebak every night, minus Steam (games can be downloaded again) and .cache (junk).
It’s a short script run by a user-level systemd timer:
#!/bin/sh
exec rsync -aHx --delete --delete-excluded \
--exclude='.local/share/Steam/' \
--exclude='.cache/' \
-e "ssh -i $HOME/.ssh/truebak -o BatchMode=yes" \
/home/daniel/ truenas_admin@truebak:/mnt/bak/tufmachine/
The timer runs it at 11:30 PM. A few things make it behave:
Persistent=trueon the timer. If the laptop was asleep at 11:30, it runs the next time it wakes up.loginctl enable-linger, so the timer runs even when I’m logged out.- A port check before it runs. If truebak isn’t reachable (say I’m not home), the run quietly skips instead of failing.
OnFailure=fires a tiny second service that sends me a Telegram message with the last few log lines. Only real failures page me.
First run: error. Forgot to
chmod +xthe script.
Second run: error. Never accepted truebak’s SSH host key. SSH in once by hand, then try again.
Third run: taking forever.
My laptop mounts NAStalgia’s media share under my home folder. rsync was faithfully backing up the entire media server through my laptop to the backup server. Ha.
The fix is -x (--one-file-system), which tells rsync not to cross into other mounted filesystems. That’s better than excluding one folder, because it also covers any mount I add later. (On btrfs, check that you don’t have subvolumes nested inside your home folder first. -x skips those too.)
One quirk: with a single -x, rsync still sends the mount point as an empty directory, and it won’t delete what’s already inside it on the other end. So the 182 GB it had already copied stayed put. I deleted it by hand, before the first nightly snapshot could lock it in for 8 weeks.
Backing up the media share
Not everything on NAStalgia needs a second copy. Movies and TV are 24 TB, and they can be replaced, if painfully. What can’t be replaced comes to about 410 GB: old backups, documents, my working files, config exports, books.
Those are plain folders inside one big dataset, and ZFS replication sends whole datasets, not folders. So this one is a TrueNAS rsync task on NAStalgia, pushing to truebak over SSH at 11:45 PM, with filters to pick the folders:
--include=/bak/*** --include=/Vera/*** --include=/Working/*** --include=/etc/*** --include=/Books/*** --exclude=*
First run: “Success!” Instantly. Nothing copied.
The source path had no trailing slash. Without it, rsync copies the directory itself, so every file’s name starts with storage/, none of my /bak/***-style filters match, and --exclude=* throws out everything. rsync considers “I sent nothing, as instructed” a success. Add the slash, and it works.
Next run: “Partial.”
“Partial” is rsync exit code 23: some files couldn’t be read. The task was running as my admin user, and about 23,000 files in an old home-directory dump weren’t readable by it. Setting the task to run as root fixed it. I could have excluded all those cache files, but I’d rather it all come across.
Snapshots, or why --delete is scary
Both rsync jobs use --delete, so the backup mirrors the source. That means if I delete a file on my laptop, it disappears from the backup the very next night.
That’s a mirror, not a backup. The fix is a daily snapshot of both datasets on truebak at 12:45 AM, kept for 8 weeks. Delete something by accident and I have two months to notice.
The whole night now looks like this:
| Time | Job |
|---|---|
| 11:30 PM | Laptop rsync |
| 11:45 PM | Media folders rsync |
| 12:00 AM | ZFS replication (Plex appdata + VMs) |
| 12:45 AM | Snapshots of the rsync targets |
The drives wake up once, do everything, and go back to sleep.
Proving it works
A backup you’ve never restored from is a rumor. Before calling it done:
- Scrub task exists on the backup pool. Sundays, 2 AM.
- Restored a file from a snapshot. On TrueNAS, every dataset has a hidden
.zfs/snapshot/folder with every snapshot browsable as plain files. - Cloned a replicated VM disk and made sure it was usable.
- Exported both TrueNAS configs, including the secret seed. Without the seed, a restored config can’t decrypt saved passwords and keys. (The setting moved in 25.10. It’s now under System → Advanced Settings → Manage Configuration.) Both files live in a folder that’s itself backed up, so each box’s config exists on both boxes.
What I’d do again, and what I wouldn’t
Again:
- Burn in every drive before it touches a pool. It caught bad ones, including two of my 8 TBs.
- Decide parity before anything else. You can’t change it later.
- Back up what’s irreplaceable, not everything. 410 GB is a lot cheaper to protect than 24 TB.
- Put snapshots under anything that uses
--delete. - Line every job up in one window so the drives spin up once a night.
- Test a restore before calling it done.
Not again:
- Trust rsync’s “success” without checking that something actually moved.
- Forget that my laptop has the whole media server mounted inside my home folder.
- Stop at the forum answer when the error doesn’t quite fit.
The old Datto has a new job, and it’s doing it quietly every night at midnight. NAStalgia finally has somewhere to land if the worst happens.
For the server this box protects, see Migrating Plex, new NAS build.