Home server migration to Debian
Moving my small home server off Windows, WSL2 and Hyper-V onto native Debian 13: all the containers and the mail server, with nightly backups, a rollback path and a few lessons.
Why
My home server was a small PC running Windows, with Docker inside WSL2 and the mail server inside a Hyper-V virtual machine. It worked, but every layer added something to babysit: Windows updates and forced reboots, a virtual network inside another virtual network, permissions inherited from the Windows file system, a firewall that Docker rewrites. I thought for a while about buying a new machine, then dropped the idea: the problem was the virtualisation, not the power. So the plan was to keep the same hardware and run everything natively on Linux.
What I decided
- Debian 13, minimal install, no desktop: a desktop would suspend the machine and its network manager would clash with the plain network configuration I wanted.
- Everything moves, including the containers that are stopped or rarely used. Only one leftover from the Windows world was left behind on purpose.
- Backups are part of the project, not an afterthought: a nightly encrypted backup to the NAS, with the databases dumped properly and the mail server’s own backup tool, all finished well before the NAS’s own nightly copy. Failures send me an email.
- A clean power-off when the UPS runs low, through the standard UPS tools: at 20% charge the server shuts down and sends me an email, then tells the UPS to cut its output, so the machine starts again by itself when the power returns.
- No weekly reboot any more (it only existed for Windows updates), and security updates install by themselves without restarting the machine.
- Windows stayed as a rollback, for as long as it was useful: the new system lived on a new SSD, the old disks untouched, and if something had gone wrong I would have booted the old system from the firmware menu. On 20 November I chose to close that door (see Status).
A written procedure, then the night
Before touching anything I wrote the whole thing as a step-by-step procedure with a checklist: last export from Windows, hardware, installation, base configuration, Docker and the containers, the mail server, backups, finishing touches, cleanup, rollback. The mail server got its own care: it is the one service whose downtime other people notice, and its backup tool has sharp edges.
The migration itself took one evening, on 13 November 2026. Mail was stopped for about three hours, then came back, and I checked that sending and receiving worked and that the usual authentication checks for outgoing mail still passed. I also ran a first full backup and, more important, a restore test.
Lessons
- A version label can lie. The mail server’s version, as shown on the old virtual machine, was a local commit that doesn’t exist upstream. To know what it really was, I had to read the virtual disk and find the upstream commit it was built from.
- A restore tool can restart things by itself. The mail server’s restore command restarts the whole stack on its own. If the database is still empty at that moment, incoming mail bounces, so the containers have to be created first without starting them.
- Permissions inherited from Windows are rarely right. Many folders turned out to be world-writable, a leftover of the Windows file system and WSL. I fixed them, keeping a record of the old values, and left only the secrets readable by their owner.
- Hardware rules apply on the next boot, not now. The UPS only worked after a reboot, because the device rules aren’t re-applied while the machine is running.
- A log can leak a secret. A library was logging full request addresses, which for a Telegram bot contain its token. Now that library logs only warnings.
- A disk can fail quietly. The system disk started reporting CRC errors on its link, which usually means a bad cable. For now I limited the link speed, which is a workaround, and the cable will be replaced the next time I open the machine; then I’ll lift the limit and test again.
- Monitoring can say 100% while the batteries are dead. The UPS showed an error on its display and the monitoring still reported a full charge. Until the batteries are replaced, a blackout would switch the server off abruptly, so the clean-shutdown setup is configured and its alert email tested, but not yet proven by a real outage.
- Passwordless administration is a loan. During the migration I allowed myself administrator commands without a password, to move fast; the last step is to take that away again.
Status
Migrated and running since 13 November 2026, and complete since 21 November. Everything works, with first backup and restore verified. Since then I added the finishing touches: the shutdown on low battery, the shared folders of the other NAS boxes that the server needs, mounted on demand, and a file share of its own for downloads. I meant to do the final cleanup after two weeks without problems, but on 20 November, after one week, I decided to bring it forward, and did it in a single day:
- The system moved to a faster disk: Debian was copied onto the small SSD that used to host Windows, attached straight to the motherboard and free of the cable errors that had slowed the old disk. A live copy, then a short second one with Docker stopped: mail was down for about five minutes, and after the reboot everything came back by itself.
- The container data sits on another fast SSD, the one with the old Windows data. An instructive surprise: with recent Docker versions the images are not in Docker’s folder but in containerd’s, so there were two folders to move, not one.
- The old system disk is now a local copy of the backups, besides the one on the NAS, with the same snapshots. Windows is gone, and so is the rollback: I preferred having it and not using it, and then not having it. On 21 November the last two items: I removed the temporary administrator shortcut (the passwordless sudo used during the migration, after checking that the normal password worked) and cleaned the NAS of the old virtual machine’s exports and the migration copy, about 200 GB in all. I did not even keep a last export as an archive: if needed, the backups are there.
With that the migration is complete. Three things remain that are now ordinary maintenance, not migration: replacing the UPS batteries with a real blackout test, a real test of waking the machine over the network, and deleting the safety copies left on the system disk after a few days without problems. I won’t fix the cable of the old disk: it now only holds a copy of the backups, and a speed limit does no harm.
Stack
Debian · Docker · restic · UPS tools · systemd