<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>borg | mutschler.dev</title><link>https://mutschler.dev/tag/borg/</link><atom:link href="https://mutschler.dev/tag/borg/index.xml" rel="self" type="application/rss+xml"/><description>borg</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Wed, 18 Nov 2026 00:00:00 +0000</lastBuildDate><image><url>https://mutschler.dev/media/icon_hu589851f325050e29bd29c51f9d799271_45964_512x512_fill_lanczos_center_3.png</url><title>borg</title><link>https://mutschler.dev/tag/borg/</link></image><item><title>Dell Wyse 5070 Thin Client: Ubuntu Server 26.04 LTS, BTRFS and Nextcloud AIO with a Tailscale sidecar</title><link>https://mutschler.dev/linux/wyse-ubuntu-nextcloud-aio/</link><pubDate>Wed, 18 Nov 2026 00:00:00 +0000</pubDate><guid>https://mutschler.dev/linux/wyse-ubuntu-nextcloud-aio/</guid><description>&lt;p>&lt;em>&lt;strong>Please feel free to raise any comments or issues on the &lt;a href="https://github.com/wmutschl/mutschler.dev" target="_blank" rel="noopener">website&amp;rsquo;s Github repository&lt;/a>.
Pull requests are very much appreciated.&lt;/strong>&lt;/em>
&lt;a href="https://www.buymeacoffee.com/mutschler" target="_blank">&lt;img src="https://cdn.buymeacoffee.com/buttons/v2/default-red.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" >&lt;/a>&lt;/p>
&lt;details class="toc-inpage d-print-none d-xl-none " open>
&lt;summary class="font-weight-bold">Table of Contents&lt;/summary>
&lt;nav id="TableOfContents">
&lt;ul>
&lt;li>&lt;a href="#overview">Overview&lt;/a>&lt;/li>
&lt;li>&lt;a href="#1-the-intended-layout">1 The intended layout&lt;/a>&lt;/li>
&lt;li>&lt;a href="#2-preparations">2 Preparations&lt;/a>&lt;/li>
&lt;li>&lt;a href="#3-install-ubuntu-on-an-encrypted-system-disk">3 Install Ubuntu on an encrypted system disk&lt;/a>
&lt;ul>
&lt;li>&lt;a href="#31-prepare-the-disk-in-the-installer-shell">3.1 Prepare the disk in the installer shell&lt;/a>&lt;/li>
&lt;li>&lt;a href="#32-install-ubuntu">3.2 Install Ubuntu&lt;/a>&lt;/li>
&lt;li>&lt;a href="#33-encrypt-the-system-partition-in-place">3.3 Encrypt the system partition in place&lt;/a>&lt;/li>
&lt;li>&lt;a href="#34-first-encrypted-boot">3.4 First encrypted boot&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;a href="#4-mount-the-other-subvolumes-before-installing-docker">4 Mount the other subvolumes before installing Docker&lt;/a>&lt;/li>
&lt;li>&lt;a href="#5-update-and-harden-the-ubuntu-host">5 Update and harden the Ubuntu host&lt;/a>
&lt;ul>
&lt;li>&lt;a href="#51-packages-updates-and-disk-health">5.1 Packages, updates and disk health&lt;/a>&lt;/li>
&lt;li>&lt;a href="#52-ubuntu-pro-and-livepatch">5.2 Ubuntu Pro and Livepatch&lt;/a>&lt;/li>
&lt;li>&lt;a href="#53-the-scripts-repository">5.3 The scripts repository&lt;/a>&lt;/li>
&lt;li>&lt;a href="#54-simple-wired-networking">5.4 Simple wired networking&lt;/a>&lt;/li>
&lt;li>&lt;a href="#55-key-only-ssh-verified-before-password-login-is-disabled">5.5 Key-only SSH, verified before password login is disabled&lt;/a>&lt;/li>
&lt;li>&lt;a href="#56-firewall-and-service-exposure">5.6 Firewall and service exposure&lt;/a>&lt;/li>
&lt;li>&lt;a href="#57-unlocking-the-system-disk-over-ssh">5.7 Unlocking the system disk over SSH&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;a href="#6-install-docker-with-storage-safeguards">6 Install Docker with storage safeguards&lt;/a>
&lt;ul>
&lt;li>&lt;a href="#61-safeguards-before-dockers-first-start">6.1 Safeguards before Docker&amp;rsquo;s first start&lt;/a>&lt;/li>
&lt;li>&lt;a href="#62-installation">6.2 Installation&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;a href="#7-backup-disks-snapshots-alerts-and-the-home-assistant-share">7 Backup disks, snapshots, alerts and the Home Assistant share&lt;/a>
&lt;ul>
&lt;li>&lt;a href="#71-alerts-to-healthchecksio">7.1 Alerts to healthchecks.io&lt;/a>&lt;/li>
&lt;li>&lt;a href="#72-prepare-the-two-hdds">7.2 Prepare the two HDDs&lt;/a>&lt;/li>
&lt;li>&lt;a href="#73-hourly-snapshots-and-daily-sendreceive-with-btrbk">7.3 Hourly snapshots and daily send/receive with BTRBK&lt;/a>&lt;/li>
&lt;li>&lt;a href="#74-disk-health-monthly-scrub-and-smart-monitoring">7.4 Disk health: monthly scrub and SMART monitoring&lt;/a>&lt;/li>
&lt;li>&lt;a href="#75-backup-share-for-home-assistant">7.5 Backup share for Home Assistant&lt;/a>&lt;/li>
&lt;li>&lt;a href="#76-off-site-mirror-on-a-hetzner-storage-box">7.6 Off-site mirror on a Hetzner Storage Box&lt;/a>&lt;/li>
&lt;li>&lt;a href="#77-restore-from-the-storage-box">7.7 Restore from the Storage Box&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;a href="#8-prepare-tailscale-for-the-host-and-the-sidecar">8 Prepare Tailscale for the host and the sidecar&lt;/a>
&lt;ul>
&lt;li>&lt;a href="#81-tailscale-admin-console">8.1 Tailscale admin console&lt;/a>&lt;/li>
&lt;li>&lt;a href="#82-on-the-wyse">8.2 On the Wyse&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;a href="#9-nextcloud">9 Nextcloud&lt;/a>
&lt;ul>
&lt;li>&lt;a href="#91-plan-the-tailscale-node-name-for-nextcloud">9.1 Plan the Tailscale node name for Nextcloud&lt;/a>&lt;/li>
&lt;li>&lt;a href="#92-configure-the-deployment-on-the-wyse">9.2 Configure the deployment on the Wyse&lt;/a>&lt;/li>
&lt;li>&lt;a href="#93-path-a-fresh-nextcloud-install">9.3 Path A: fresh Nextcloud install&lt;/a>&lt;/li>
&lt;li>&lt;a href="#94-path-b-reinstall-from-an-aio-backup">9.4 Path B: reinstall from an AIO backup&lt;/a>&lt;/li>
&lt;li>&lt;a href="#95-after-either-path-nextcloud-configuration">9.5 After either path: Nextcloud configuration&lt;/a>&lt;/li>
&lt;li>&lt;a href="#96-later-logins-to-the-aio-interface">9.6 Later logins to the AIO interface&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;a href="#10-backups-and-ongoing-care">10 Backups and ongoing care&lt;/a>
&lt;ul>
&lt;li>&lt;a href="#101-aio-borg-backup-to-hdd-2">10.1 AIO Borg backup to HDD 2&lt;/a>&lt;/li>
&lt;li>&lt;a href="#102-host-configuration-and-recovery-material">10.2 Host configuration and recovery material&lt;/a>&lt;/li>
&lt;li>&lt;a href="#103-snapshots-around-risky-changes">10.3 Snapshots around risky changes&lt;/a>&lt;/li>
&lt;li>&lt;a href="#104-regular-checks">10.4 Regular checks&lt;/a>&lt;/li>
&lt;li>&lt;a href="#105-restore-drills">10.5 Restore drills&lt;/a>&lt;/li>
&lt;li>&lt;a href="#106-updates">10.6 Updates&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/nav>
&lt;/details>
&lt;h2 id="overview">Overview&lt;/h2>
&lt;figure id="figure-dell-wyse-5070">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="A Dell Wyse 5070 Thin Client seen from the front and side" srcset="
/media/dell-wyse-5070_hubda6bc9d6fa4b8e756baa6c41084eff6_2791494_8407e8cdeb43c4cd49ee5028dd3c9666.webp 400w,
/media/dell-wyse-5070_hubda6bc9d6fa4b8e756baa6c41084eff6_2791494_55be0c2768ee3fe6d2e3ad4bc206782d.webp 760w,
/media/dell-wyse-5070_hubda6bc9d6fa4b8e756baa6c41084eff6_2791494_1200x1200_fit_q75_h2_lanczos.webp 1200w"
src="https://mutschler.dev/media/dell-wyse-5070_hubda6bc9d6fa4b8e756baa6c41084eff6_2791494_8407e8cdeb43c4cd49ee5028dd3c9666.webp"
width="760"
height="507"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
A Dell Wyse 5070 Thin Client. Image credit: &lt;a href="https://commons.wikimedia.org/wiki/File:Dell_Wyse_5070_03.jpg" target="_blank" rel="noopener">&lt;strong>-stk&lt;/strong>&lt;/a>, &lt;a href="https://creativecommons.org/licenses/by-sa/4.0" target="_blank" rel="noopener">CC BY-SA 4.0&lt;/a>, via Wikimedia Commons
&lt;/figcaption>&lt;/figure>
&lt;p>My Dell Wyse 5070 Thin Client is my home server.
Ubuntu Server 26.04 LTS runs Nextcloud All-in-One (AIO) in Docker behind a &lt;strong>Tailscale sidecar container&lt;/strong>, and a Samba share collects the backups of my &lt;a href="https://mutschler.dev/linux/raspi-home-assistant-os/">Raspberry Pi with Home Assistant&lt;/a>.
In this guide, Tailscale Funnel publishes Nextcloud on HTTPS port 443, so it is reachable from the internet.
Tailscale Serve without Funnel is the more secure alternative: it keeps Nextcloud reachable only from devices in your tailnet.
The note &lt;strong>Serve instead of Funnel&lt;/strong> in &lt;a href="#92-configure-the-deployment-on-the-wyse">section 9.2&lt;/a> lists what changes.
The AIO interface stays tailnet-only on port 8080.
The host itself is on the tailnet as well, for SSH from anywhere.
Nothing is forwarded on the router, a FRITZ!Box in my case, which could not forward IPv4 anyway because my line is DS-Lite.
The FRITZ!Box reserves a fixed IP address for the Wyse, &lt;code>192.168.178.55&lt;/code>.&lt;/p>
&lt;p>This is my hardware:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Dell Wyse 5070 Thin Client&lt;/strong> with an Intel Celeron J4105 (4 cores, with AES-NI) and 32 GB RAM.&lt;/li>
&lt;li>&lt;strong>Verbatim Vi560 2 TB SATA SSD&lt;/strong> as the system disk.
The built-in 29.1 GiB eMMC stays unused.&lt;/li>
&lt;li>&lt;strong>Two USB HDDs&lt;/strong> for backups: a 6 TB WD Elements and a 4 TB Toshiba.&lt;/li>
&lt;li>&lt;strong>Ethernet cable&lt;/strong> to the FRITZ!Box.&lt;/li>
&lt;li>&lt;strong>A Mac&lt;/strong> for the SSH sessions; any computer with SSH works just as well.&lt;/li>
&lt;/ul>
&lt;p>My separate guide &lt;a href="https://mutschler.dev/linux/wyse-hardware/">Dell Wyse 5070 Thin Client: RAM and SSD upgrade, BIOS update and BIOS settings&lt;/a> shows how I upgraded the RAM and the SSD, flashed the latest BIOS and went through the BIOS settings.
This guide starts where that one ends.&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>What is new in Ubuntu 26.04 LTS (Resolute Raccoon) compared with 22.04 and 24.04:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Kernel:&lt;/strong> Linux 7.0.&lt;/li>
&lt;li>&lt;strong>sudo:&lt;/strong> &lt;code>sudo&lt;/code> is sudo-rs by default; &lt;code>sudoedit&lt;/code> works.&lt;/li>
&lt;li>&lt;strong>Core tools:&lt;/strong> most coreutils are the Rust implementation, while &lt;code>cp&lt;/code>, &lt;code>mv&lt;/code>, &lt;code>rm&lt;/code> and &lt;code>df&lt;/code> remain GNU.
The commands in this guide avoid the known gaps, such as &lt;code>chown user:&lt;/code> with a trailing colon.&lt;/li>
&lt;li>&lt;strong>SSH:&lt;/strong> OpenSSH 10.2, still socket-activated, and &lt;code>/etc/ssh/sshd_config.d/&lt;/code> is still read first.&lt;/li>
&lt;li>&lt;strong>Initrd:&lt;/strong> dracut builds it instead of initramfs-tools; &lt;code>update-initramfs&lt;/code> remains as a wrapper.
That changes how the encrypted SSD is unlocked over SSH (&lt;a href="#57-unlocking-the-system-disk-over-ssh">section 5.7&lt;/a>).&lt;/li>
&lt;li>&lt;strong>Docker:&lt;/strong> its repository has a &lt;code>resolute&lt;/code> suite.&lt;/li>
&lt;/ul>
&lt;/div>
&lt;/div>
&lt;p>I cover two ways of bringing Nextcloud up.
Decide before AIO starts for the first time, because a restore has to begin from a fresh, unconfigured AIO mastercontainer:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Path&lt;/th>
&lt;th>Result&lt;/th>
&lt;th>Use it for&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>A: fresh install&lt;/strong> (&lt;a href="#93-path-a-fresh-nextcloud-install">section 9.3&lt;/a>)&lt;/td>
&lt;td>A new, empty Nextcloud; files can be imported afterwards&lt;/td>
&lt;td>A clean start; accounts, shares and settings are created anew&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>B: reinstall from an AIO backup&lt;/strong> (&lt;a href="#94-path-b-reinstall-from-an-aio-backup">section 9.4&lt;/a>)&lt;/td>
&lt;td>The previous instance with its accounts, shares, calendars, file versions and settings&lt;/td>
&lt;td>Moving an existing AIO instance to the Wyse (I moved mine from my Mac mini), and rebuilding the Wyse later, e.g. after reinstalling Ubuntu or replacing the SSD&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The deployment and the host configuration live in my &lt;a href="https://github.com/wmutschl/scripts" target="_blank" rel="noopener">scripts repository&lt;/a>:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>File&lt;/th>
&lt;th>Purpose&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;a href="https://github.com/wmutschl/scripts/tree/main/Dell-Wyse-Thin-Client-5070" target="_blank" rel="noopener">&lt;code>Dell-Wyse-Thin-Client-5070/&lt;/code>&lt;/a>&lt;/td>
&lt;td>&lt;code>etc/&lt;/code> and &lt;code>usr/&lt;/code> hold the host configuration at its target paths: SSH, the initrd for the encrypted SSD, Docker, BTRBK, Samba, smartd, and the &lt;code>dell-wyse-*&lt;/code> systemd units and scripts; sections 5 to 7 copy the files into place. The top level holds the compose file, &lt;code>dell-wyse.env&lt;/code>, and the template &lt;code>host.env.example&lt;/code> for &lt;code>/etc/dell-wyse&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="https://github.com/wmutschl/scripts/blob/main/Dell-Wyse-Thin-Client-5070/dell-wyse.env" target="_blank" rel="noopener">&lt;code>Dell-Wyse-Thin-Client-5070/dell-wyse.env&lt;/code>&lt;/a>&lt;/td>
&lt;td>Template for &lt;code>~/scripts/Dell-Wyse-Thin-Client-5070/.env&lt;/code> on the Wyse&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="https://github.com/wmutschl/scripts/blob/main/Dell-Wyse-Thin-Client-5070/docker-compose.yml" target="_blank" rel="noopener">&lt;code>Dell-Wyse-Thin-Client-5070/docker-compose.yml&lt;/code>&lt;/a>&lt;/td>
&lt;td>Tailscale sidecar and AIO mastercontainer&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="https://github.com/wmutschl/scripts/blob/main/Tailscale/nextcloud-funnel.json" target="_blank" rel="noopener">&lt;code>Tailscale/nextcloud-funnel.json&lt;/code>&lt;/a>&lt;/td>
&lt;td>Serve configuration with Funnel, the default; the sidecar mounts the whole shared &lt;code>Tailscale/&lt;/code> folder read-only&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;a href="https://github.com/wmutschl/scripts/blob/main/Tailscale/nextcloud-serve.json" target="_blank" rel="noopener">&lt;code>Tailscale/nextcloud-serve.json&lt;/code>&lt;/a>&lt;/td>
&lt;td>The same without Funnel, for a Nextcloud that is reachable only from the tailnet (&lt;a href="#92-configure-the-deployment-on-the-wyse">section 9.2&lt;/a>)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="1-the-intended-layout">1 The intended layout&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Component&lt;/th>
&lt;th>Location / decision&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>System SSD&lt;/td>
&lt;td>LUKS2 partition &lt;code>wyse-system&lt;/code> with the BTRFS pool inside, unlocked at boot with a passphrase that I type over SSH into the initrd; swap encrypted with a new random key at every boot; EFI and &lt;code>/boot&lt;/code> plain (&lt;a href="#3-install-ubuntu-on-an-encrypted-system-disk">section 3&lt;/a>)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Ubuntu&lt;/td>
&lt;td>&lt;code>@root&lt;/code>, mounted at &lt;code>/&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Administrator files&lt;/td>
&lt;td>&lt;code>@home&lt;/code>, mounted at &lt;code>/home&lt;/code>; includes &lt;code>~/scripts&lt;/code>, with the compose file and &lt;code>.env&lt;/code> in &lt;code>Dell-Wyse-Thin-Client-5070/&lt;/code> and the serve configuration in &lt;code>Tailscale/&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Docker configuration and named volumes&lt;/td>
&lt;td>&lt;code>@docker&lt;/code>, mounted at &lt;code>/var/lib/docker&lt;/code>: AIO database, Nextcloud installation, mastercontainer configuration, sidecar state&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Container images and snapshots (Docker 29+)&lt;/td>
&lt;td>&lt;code>@containerd&lt;/code>, mounted at &lt;code>/var/lib/containerd&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Nextcloud user data&lt;/td>
&lt;td>&lt;code>@nextcloud&lt;/code>, mounted at &lt;code>/srv/nextcloud&lt;/code>; AIO data directory &lt;code>/srv/nextcloud/data&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Home Assistant backups from the Pi&lt;/td>
&lt;td>&lt;code>@ha-backups&lt;/code>, mounted at &lt;code>/srv/ha-backups&lt;/code>, shared over SMB to the Pi only&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Hourly snapshots&lt;/td>
&lt;td>&lt;code>@snapshots&lt;/code>, reached through the top-level mount &lt;code>/mnt/wyse-top&lt;/code>; kept 48 hours hourly and 7 days daily&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>HDD 1 (WD Elements, 6 TB), label &lt;code>wyse-btrbk&lt;/code>&lt;/td>
&lt;td>LUKS2-encrypted BTRFS at &lt;code>/mnt/btrbk&lt;/code>, unlocked at boot by a keyfile on the encrypted SSD; daily &lt;code>btrfs send/receive&lt;/code> of the snapshots, kept 30 days, 12 weeks and 12 months&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>HDD 2 (Toshiba, 4 TB), label &lt;code>wyse-borg&lt;/code>&lt;/td>
&lt;td>BTRFS at &lt;code>/mnt/backup&lt;/code>; AIO&amp;rsquo;s daily Borg repository in &lt;code>/mnt/backup/borg&lt;/code>, encrypted by Borg&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Off-site&lt;/td>
&lt;td>Nightly mirror of the Borg repository and the HA backups on a Hetzner Storage Box over SSH, protected by the Storage Box&amp;rsquo;s own snapshots (&lt;a href="#76-off-site-mirror-on-a-hetzner-storage-box">section 7.6&lt;/a>)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Monitoring&lt;/td>
&lt;td>healthchecks.io: the backup jobs, the scrub, SMART, the arrival of HA&amp;rsquo;s backups and an uptime ping&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Public access&lt;/td>
&lt;td>Funnel &lt;code>https://nextcloud.tailnet-name.ts.net&lt;/code> → sidecar → &lt;code>nextcloud-aio-apache:11000&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>AIO interface&lt;/td>
&lt;td>Tailnet only: &lt;code>https://nextcloud.tailnet-name.ts.net:8080&lt;/code> → sidecar → mastercontainer. Break-glass: host loopback &lt;code>127.0.0.1:8080&lt;/code> through SSH&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Tailnet nodes&lt;/td>
&lt;td>The host &lt;code>dell-wyse&lt;/code> (&lt;code>tag:server&lt;/code>), for SSH; the sidecar &lt;code>nextcloud&lt;/code> (&lt;code>tag:nextcloud&lt;/code>), for Nextcloud and the AIO interface&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Listening on the LAN&lt;/td>
&lt;td>SSH from the LAN, SMB from the Pi only&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>&lt;code>tailnet-name.ts.net&lt;/code> stands for the DNS name of your tailnet throughout this guide (&lt;a href="#81-tailscale-admin-console">section 8.1&lt;/a>).
The seven BTRFS subvolumes share the SSD&amp;rsquo;s free space; they are not fixed-size partitions.
Keeping the container stores separate makes root snapshots smaller and shows where AIO&amp;rsquo;s database and configuration live.
Those named volumes matter just as much as &lt;code>/srv/nextcloud/data&lt;/code>.
A snapshot of &lt;code>@root&lt;/code> alone does not capture sibling &lt;a href="https://btrfs.readthedocs.io/en/latest/Subvolumes.html" target="_blank" rel="noopener">subvolumes&lt;/a>.&lt;/p>
&lt;p>My Nextcloud instance holds about &lt;strong>860 GiB&lt;/strong> of data, and the Wyse&amp;rsquo;s SSD has roughly 2 TB raw capacity, so it is a sensible target.
This is a single SSD, not redundant storage; the two HDD copies and the off-site mirror from &lt;a href="#7-backup-disks-snapshots-alerts-and-the-home-assistant-share">section 7&lt;/a> are what protect it.
The separate &lt;strong>29.1 GiB eMMC is not an installation target&lt;/strong>.&lt;/p>
&lt;h2 id="2-preparations">2 Preparations&lt;/h2>
&lt;ol>
&lt;li>Download the Ubuntu Server &lt;strong>26.04 LTS amd64&lt;/strong> ISO, verify its signed checksum and write it to a disposable &lt;a href="https://ubuntu.com/desktop/docs/en/latest/how-to/create-a-bootable-usb-stick" target="_blank" rel="noopener">installer USB stick&lt;/a>.&lt;/li>
&lt;li>Press F2 at power-on to enter the Wyse&amp;rsquo;s firmware setup and check these settings: UEFI boot with Secure Boot enabled for Ubuntu, SATA in AHCI mode, and the normal CPU power-saving features.
Set &lt;strong>AC Recovery&lt;/strong> to &lt;strong>Power On&lt;/strong> if the Wyse should start again after a power outage; it then waits for the SSH unlock (&lt;a href="#57-unlocking-the-system-disk-over-ssh">section 5.7&lt;/a>).
If you followed my &lt;a href="https://mutschler.dev/linux/wyse-hardware/#3-go-through-the-bios-settings">hardware and BIOS guide&lt;/a>, all of this is already set; it lists every BIOS setting I use.&lt;/li>
&lt;li>Reboot and press F12 to boot from the USB stick in UEFI mode.
With a BIOS admin password and &lt;strong>UEFI Boot Path Security&lt;/strong> set as in my &lt;a href="https://mutschler.dev/linux/wyse-hardware/#31-general">hardware and BIOS guide&lt;/a>, the Wyse asks for the admin password first.&lt;/li>
&lt;/ol>
&lt;p>&lt;strong>Encryption:&lt;/strong> the system SSD is going to be encrypted (&lt;a href="#3-install-ubuntu-on-an-encrypted-system-disk">section 3&lt;/a>), and so is HDD 1, which holds plain copies of everything on it (&lt;a href="#72-prepare-the-two-hdds">section 7.2&lt;/a>).
A dead, returned or discarded disk exposes nothing, and neither does a stolen Wyse.
Every boot waits for the passphrase, which I type over SSH into the initrd from my Mac.
HDD 2 and everything that leaves the house are encrypted by Borg and Home Assistant themselves.
Nextcloud&amp;rsquo;s server-side encryption is not used: its keys would sit on the same disks, and in the same backups, as the files.&lt;/p>
&lt;h2 id="3-install-ubuntu-on-an-encrypted-system-disk">3 Install Ubuntu on an encrypted system disk&lt;/h2>
&lt;p>The finished SSD:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Partition&lt;/th>
&lt;th>Size&lt;/th>
&lt;th>Content&lt;/th>
&lt;th>At boot&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>1 &lt;code>wyse-efi&lt;/code>&lt;/td>
&lt;td>1 GiB&lt;/td>
&lt;td>EFI system partition, FAT32, &lt;code>/boot/efi&lt;/code>&lt;/td>
&lt;td>Plain: the signed shim and GRUB&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>2 &lt;code>wyse-boot&lt;/code>&lt;/td>
&lt;td>2 GiB&lt;/td>
&lt;td>ext4, &lt;code>/boot&lt;/code>&lt;/td>
&lt;td>Plain: kernels and initrds&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>3 &lt;code>wyse-swap&lt;/code>&lt;/td>
&lt;td>8 GiB&lt;/td>
&lt;td>Swap&lt;/td>
&lt;td>Encrypted with a new random key at every boot&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>4 &lt;code>wyse-system&lt;/code>&lt;/td>
&lt;td>The rest, about 1.85 TiB&lt;/td>
&lt;td>LUKS2, opened as &lt;code>wyse-system&lt;/code>, with the BTRFS pool and its seven subvolumes inside&lt;/td>
&lt;td>Passphrase, typed over SSH into the initrd or at the console (&lt;a href="#57-unlocking-the-system-disk-over-ssh">section 5.7&lt;/a>)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The installer cannot create BTRFS subvolumes, and it cannot be relied on to install into a LUKS container prepared by hand.
So this takes four steps:&lt;/p>
&lt;ol>
&lt;li>Prepare the disk in the installer&amp;rsquo;s shell, with a deliberately small BTRFS partition.&lt;/li>
&lt;li>Install Ubuntu onto it unencrypted.&lt;/li>
&lt;li>Encrypt that partition in place from the installer USB stick.&lt;/li>
&lt;li>Grow it over the rest of the SSD.&lt;/li>
&lt;/ol>
&lt;p>Encrypting 64 GiB in place takes minutes; a pass over the whole 2 TB would take hours.
The space added afterwards is encrypted from the start.
Nothing old can surface in it, because the first step discards the whole SSD.&lt;/p>
&lt;p>The swap partition avoids the additional restrictions of BTRFS swapfiles.
Its random key means that nothing in it is readable after power-off.
The price is hibernation, which a server does not need.&lt;/p>
&lt;h3 id="31-prepare-the-disk-in-the-installer-shell">3.1 Prepare the disk in the installer shell&lt;/h3>
&lt;p>In the Ubuntu installer, open &lt;strong>Help → Enter shell&lt;/strong>.&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
&lt;strong>SSH into the installer.&lt;/strong>
For easier copying and pasting of commands, you can also connect to the installer via SSH from another machine.
Open &lt;strong>Help → Help on SSH access&lt;/strong> and follow the instructions.
Every boot of the installer has its own host key, and so does the installed system later, all on the same address.
So when ssh warns that the host key has changed, remove the old entry on the Mac with &lt;code>ssh-keygen -R &amp;lt;address&amp;gt;&lt;/code> and connect again.
&lt;/div>
&lt;/div>
&lt;p>Inspect first:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">lsblk -b -o NAME,SIZE,MODEL,SERIAL,TYPE,FSTYPE,MOUNTPOINTS
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME SIZE MODEL SERIAL TYPE FSTYPE MOUNTPOINTS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop0 1335115776 loop squashfs /rofs&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop1 156299264 loop squashfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop2 27041792 loop squashfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop3 98304 loop squashfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop4 70049792 loop squashfs /snap/core24/1643&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop5 1581056 loop squashfs /snap/hwctl/123&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop6 22769664 loop squashfs /snap/subiquity/7403&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop7 52535296 loop squashfs /snap/snapd/27710&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sda 2048408248320 Verbatim Vi560 493653348990842 disk &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda1 1073741824 part vfat &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda2 2147483648 part ext4 &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda3 8589934592 part swap &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># `-sda4 2036595687424 part btrfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdb 62914560000 Twist Line 64847016 disk iso9660 &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sdb1 2922217472 part iso9660 /cdrom&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sdb2 5271552 part vfat &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sdb3 307200 part &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># `-sdb4 59983790080 part ext4 /var/crash&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /var/log&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mmcblk0 31268536320 0x3c238908 disk btrfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mmcblk0boot0 4194304 0x3c238908 disk btrfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mmcblk0boot1 4194304 0x3c238908 disk btrfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls -l /dev/disk/by-id/ata-*
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 9 Nov 16 08:34 /dev/disk/by-id/ata-Verbatim_Vi560_493653348990842 -&amp;gt; ../../sda&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 10 Nov 16 08:34 /dev/disk/by-id/ata-Verbatim_Vi560_493653348990842-part1 -&amp;gt; ../../sda1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 10 Nov 16 08:34 /dev/disk/by-id/ata-Verbatim_Vi560_493653348990842-part2 -&amp;gt; ../../sda2&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 10 Nov 16 08:34 /dev/disk/by-id/ata-Verbatim_Vi560_493653348990842-part3 -&amp;gt; ../../sda3&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 10 Nov 16 08:34 /dev/disk/by-id/ata-Verbatim_Vi560_493653348990842-part4 -&amp;gt; ../../sda4&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">swapon --show &lt;span class="c1"># should print nothing&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>My SSD still had the partitions of an earlier installation; on a new disk, &lt;code>sda&lt;/code> has none.
Use the whole &lt;code>/dev/disk/by-id/ata-...&lt;/code> path of the verified Vi560, without a partition suffix.
The commands below &lt;strong>erase that SSD&lt;/strong>, so check the &lt;code>lsblk&lt;/code> output (model, serial, size) before continuing.
The partition boundaries in the following &lt;code>parted&lt;/code> command are cumulative offsets from the start of the disk, in MiB.
Each partition starts where the previous one ends, and the first one starts at 1 MiB to keep the alignment:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Partition&lt;/th>
&lt;th>Size&lt;/th>
&lt;th>Start&lt;/th>
&lt;th>End&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>1: &lt;code>wyse-efi&lt;/code>&lt;/td>
&lt;td>1 GiB = 1024 MiB&lt;/td>
&lt;td>1 MiB&lt;/td>
&lt;td>1 + 1024 = &lt;strong>1025 MiB&lt;/strong>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>2: &lt;code>wyse-boot&lt;/code>&lt;/td>
&lt;td>2 GiB = 2048 MiB&lt;/td>
&lt;td>1025 MiB&lt;/td>
&lt;td>1025 + 2048 = &lt;strong>3073 MiB&lt;/strong>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>3: &lt;code>wyse-swap&lt;/code>&lt;/td>
&lt;td>8 GiB = 8192 MiB&lt;/td>
&lt;td>3073 MiB&lt;/td>
&lt;td>3073 + 8192 = &lt;strong>11265 MiB&lt;/strong>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>4: &lt;code>wyse-system&lt;/code>&lt;/td>
&lt;td>64 GiB = 65536 MiB&lt;/td>
&lt;td>11265 MiB&lt;/td>
&lt;td>11265 + 65536 = &lt;strong>76801 MiB&lt;/strong>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>So 76801 MiB is the end of the 64 GiB system partition.
&lt;a href="#33-encrypt-the-system-partition-in-place">Section 3.3&lt;/a> later grows it to the end of the disk.&lt;/p>
&lt;p>Enter the commands one by one in the same terminal session, because they rely on the &lt;code>DISK&lt;/code> and &lt;code>TOP&lt;/code> shell variables.
The installer&amp;rsquo;s shell runs as root, so the commands need no &lt;code>sudo&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Set the target disk (whole disk, no -partN suffix) and confirm it is the right one&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">DISK&lt;/span>&lt;span class="o">=&lt;/span>/dev/disk/by-id/ata-Verbatim_Vi560_493653348990842
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -o NAME,MODEL,SERIAL,SIZE,FSTYPE,MOUNTPOINTS &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME MODEL SERIAL SIZE FSTYPE MOUNTPOINTS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sda Verbatim Vi560 493653348990842 1.9T &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda1 1G vfat &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda2 2G ext4 &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda3 8G swap &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># `-sda4 1.9T btrfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Make sure nothing on the disk is mounted or used as swap&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">swapoff -a
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">umount &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part* 2&amp;gt;/dev/null
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Discard all blocks and create the partitions&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">blkdiscard -f &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># blkdiscard: Operation forced, data will be lost!&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">parted -s -a optimal &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> mklabel gpt &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> mkpart wyse-efi fat32 1MiB 1025MiB &lt;span class="nb">set&lt;/span> &lt;span class="m">1&lt;/span> esp on &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> mkpart wyse-boot ext4 1025MiB 3073MiB &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> mkpart wyse-swap linux-swap 3073MiB 11265MiB &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> mkpart wyse-system btrfs 11265MiB 76801MiB
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">partprobe &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="c1"># should print nothing, kernel should re-read the new partition table&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">udevadm settle &lt;span class="c1"># should print nothing, udev should have processed all device events in the kernel queue&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -o NAME,SIZE,PARTLABEL,FSTYPE &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME SIZE PARTLABEL FSTYPE&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sda 1.9T &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda1 1G wyse-efi &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda2 2G wyse-boot &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda3 8G wyse-swap &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># `-sda4 64G wyse-system&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Prepare the EFI partition&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mkfs.fat -F &lt;span class="m">32&lt;/span> -n WYSE_EFI &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mkfs.fat 4.2 (2021-01-31)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Prepare the boot partition&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mkfs.ext4 -F -L wyse-boot &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part2
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mke2fs 1.47.2 (1-Jan-2025)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Discarding device blocks: done &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Creating filesystem with 524288 4k blocks and 131072 inodes&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Filesystem UUID: 3158056c-ac6e-454c-828c-45422492f5fa&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Superblock backups stored on blocks: &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 32768, 98304, 163840, 229376, 294912&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Allocating group tables: done &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Writing inode tables: done &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Creating journal (16384 blocks): done&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Writing superblocks and filesystem accounting information: done &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Prepare the swap partition&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mkswap -L wyse-swap &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part3
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Setting up swapspace version 1, size = 8 GiB (8589930496 bytes)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># LABEL=wyse-swap, UUID=40b11619-8ecf-4eec-8a75-49e2d7bed28e&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Prepare the BTRFS partition (note that this is just 64 GiB for now)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mkfs.btrfs -f -L wyse-system &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part4
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># btrfs-progs v6.17.1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># See https://btrfs.readthedocs.io for more information.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Performing full device TRIM /dev/disk/by-id/ata-Verbatim_Vi560_493653348990842-part4 (64.00GiB) ...&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Label: wyse-system&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UUID: 51c948e0-74f2-4f5c-b5e3-90b06f3b421f&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Node size: 16384&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Sector size: 4096 (CPU page size: 4096)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Filesystem size: 64.00GiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Block group profiles:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Data: single 8.00MiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Metadata: DUP 1.00GiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># System: DUP 8.00MiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># SSD detected: yes&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Zoned device: no&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Features: extref, skinny-metadata, no-holes, free-space-tree&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Checksum: crc32c&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Number of devices: 1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Devices:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ID SIZE PATH &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 1 64.00GiB /dev/disk/by-id/ata-Verbatim_Vi560_493653348990842-part4&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create the BTRFS subvolumes&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">TOP&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>mktemp -d&lt;span class="k">)&lt;/span> &lt;span class="c1"># temporary directory, e.g. /tmp/tmp.re3n0I61Ar&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mount -o &lt;span class="nv">subvolid&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="m">5&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part4 &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$TOP&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="c1"># mount the top level of the filesystem&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">for&lt;/span> sub in @root @home @docker @containerd @nextcloud @ha-backups @snapshots&lt;span class="p">;&lt;/span> &lt;span class="k">do&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> btrfs subvolume create &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$TOP&lt;/span>&lt;span class="s2">/&lt;/span>&lt;span class="nv">$sub&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">done&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create subvolume &amp;#39;/tmp/tmp.re3n0I61Ar/@root&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create subvolume &amp;#39;/tmp/tmp.re3n0I61Ar/@home&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create subvolume &amp;#39;/tmp/tmp.re3n0I61Ar/@docker&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create subvolume &amp;#39;/tmp/tmp.re3n0I61Ar/@containerd&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create subvolume &amp;#39;/tmp/tmp.re3n0I61Ar/@nextcloud&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create subvolume &amp;#39;/tmp/tmp.re3n0I61Ar/@ha-backups&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create subvolume &amp;#39;/tmp/tmp.re3n0I61Ar/@snapshots&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Make @root the default subvolume and unmount&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">btrfs subvolume set-default &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">$(&lt;/span>btrfs inspect-internal rootid &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$TOP&lt;/span>&lt;span class="s2">/@root&amp;#34;&lt;/span>&lt;span class="k">)&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$TOP&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">umount &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$TOP&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Verify: mounting without options must now show /@root&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mount &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part4 &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$TOP&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">findmnt -n -o FSROOT --target &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$TOP&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /@root&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">umount &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$TOP&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rmdir &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$TOP&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Reboot into the same installer USB stick, so that the installer reloads its storage view:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">reboot now
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="32-install-ubuntu">3.2 Install Ubuntu&lt;/h3>
&lt;p>Click through the installer, choose &lt;strong>Ubuntu Server (minimized)&lt;/strong> and &lt;strong>Custom storage layout&lt;/strong>:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Vi560 partition&lt;/th>
&lt;th>Installer choice&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>1: FAT32 EFI&lt;/td>
&lt;td>Boot device&amp;rsquo;s EFI partition, &lt;code>/boot/efi&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>2: ext4&lt;/td>
&lt;td>&lt;code>/boot&lt;/code>; this empty partition may be formatted&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>3: swap&lt;/td>
&lt;td>Use as swap&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>4: existing BTRFS&lt;/td>
&lt;td>&lt;strong>Leave formatted as btrfs&lt;/strong>, mount &lt;strong>Other&lt;/strong> → &lt;code>/&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>eMMC, other drives&lt;/td>
&lt;td>No formatting, mounts or bootloader action&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>With &amp;ldquo;Leave formatted&amp;rdquo;, the mount list offers only &lt;code>/home&lt;/code>, &lt;code>/srv&lt;/code>, &lt;strong>Other&lt;/strong> and &amp;ldquo;Leave unmounted&amp;rdquo;.
Choose &lt;strong>Other&lt;/strong> and enter &lt;code>/&lt;/code>; if the field already shows a leading slash, leave the rest empty.
The installer then warns that mounting an existing filesystem at &lt;code>/&lt;/code> is usually a bad idea.
That is expected here, because the filesystem holds nothing but empty subvolumes.
The installer cannot create subvolumes itself, but it mounts the filesystem&amp;rsquo;s default subvolume, which the commands above set to &lt;code>@root&lt;/code>.&lt;/p>
&lt;div class="alert alert-warning">
&lt;div>
&lt;strong>Do not reformat partition 4.&lt;/strong>
Reformatting the prepared BTRFS partition would remove its subvolumes.
Check the final summary carefully: partition 4 must not be marked for formatting.
&lt;/div>
&lt;/div>
&lt;p>Use the hostname &lt;code>dell-wyse&lt;/code> and set up your account and password.
I also opt in to &lt;a href="https://ubuntu.com/pro/attach" target="_blank" rel="noopener">attach the machine to Ubuntu Pro&lt;/a>.
Install &lt;strong>OpenSSH Server&lt;/strong>, import your public key if convenient, and skip the featured snaps.
The 26.04 server installer installs the generic kernel (&lt;code>linux-generic&lt;/code>, Linux 7.0), which is fine for this machine.
Reboot from the SSD and verify at the local console (or over SSH):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">findmnt -no SOURCE,FSTYPE,FSROOT /
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/sda4[/@root] btrfs /@root&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">findmnt /boot
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># TARGET SOURCE FSTYPE OPTIONS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /boot /dev/sda2 ext4 rw,relatime&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">findmnt /boot/efi
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># TARGET SOURCE FSTYPE OPTIONS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /boot/efi /dev/sda1 vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">swapon --show
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME TYPE SIZE USED PRIO&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/sda3 partition 8G 0B -1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -o NAME,SIZE,MODEL,SERIAL,FSTYPE,MOUNTPOINTS
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME SIZE MODEL SERIAL FSTYPE MOUNTPOINTS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop0 1.5M squashfs /snap/hwctl/123&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop1 66.8M squashfs /snap/core24/1643&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop2 50.1M squashfs /snap/snapd/27710&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop3 32.5M squashfs /snap/snapd/28332&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop4 74M squashfs /snap/core22/3129&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop5 13.2M squashfs /snap/canonical-livepatch/418&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sda 1.9T Verbatim Vi560 493653348990842 &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─sda1 1G vfat /boot/efi&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─sda2 2G ext4 /boot&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─sda3 8G swap [SWAP]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─sda4 64G btrfs /&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mmcblk0 29.1G 0x3c238908 btrfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mmcblk0boot0 4M &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mmcblk0boot1 4M&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Root must be BTRFS with &lt;strong>&lt;code>/@root&lt;/code>&lt;/strong>.
Stop and correct the installation if it is not.&lt;/p>
&lt;p>Then install what the encrypted boot needs:&lt;/p>
&lt;ul>
&lt;li>&lt;code>cryptsetup&lt;/code> and &lt;code>systemd-cryptsetup&lt;/code> open LUKS volumes.&lt;/li>
&lt;li>&lt;code>dracut-network&lt;/code> brings networking into the initrd for the SSH unlock in &lt;a href="#57-unlocking-the-system-disk-over-ssh">section 5.7&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>Ubuntu 26.04 builds its initrd with dracut instead of initramfs-tools.
Listing &lt;code>dracut&lt;/code> explicitly makes sure of that: it replaces &lt;code>initramfs-tools&lt;/code> if an installation still has it.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo apt update
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt install --no-install-recommends cryptsetup systemd-cryptsetup dracut dracut-network
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">dpkg-query -W -f&lt;span class="o">=&lt;/span>&lt;span class="s1">&amp;#39;${Package} ${db:Status-Abbrev}\n&amp;#39;&lt;/span> dracut initramfs-tools
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># dracut ii &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># initramfs-tools un&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>dracut&lt;/code> must show &lt;code>ii&lt;/code>.
&lt;code>initramfs-tools&lt;/code> must not; it shows as missing or not installed (&lt;code>un&lt;/code>).
Then shut down:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo poweroff
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="33-encrypt-the-system-partition-in-place">3.3 Encrypt the system partition in place&lt;/h3>
&lt;p>Boot the installer USB stick again and open &lt;strong>Help → Enter shell&lt;/strong> on its first screen, or connect over SSH as in &lt;a href="#31-prepare-the-disk-in-the-installer-shell">section 3.1&lt;/a>.
Enter the following commands one by one in the same terminal session, because they rely on the &lt;code>DISK&lt;/code>, &lt;code>SYS&lt;/code> and &lt;code>MNT&lt;/code> shell variables.
They work through these steps:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Make room.&lt;/strong>
Shrink the BTRFS pool by 1 GiB, which leaves space for the LUKS2 header.&lt;/li>
&lt;li>&lt;strong>Encrypt.&lt;/strong>
Encrypt partition 4 in place.
&lt;code>cryptsetup&lt;/code> asks for the new passphrase: generate a long one in your password manager and keep it there.
You type it at every boot (&lt;a href="#57-unlocking-the-system-disk-over-ssh">section 5.7&lt;/a>).&lt;/li>
&lt;li>&lt;strong>Grow.&lt;/strong>
Extend partition 4 over the rest of the SSD, open the LUKS container and extend the BTRFS pool to fill it.&lt;/li>
&lt;li>&lt;strong>Prepare the installed system&lt;/strong> through a chroot:
&lt;ul>
&lt;li>&lt;code>/etc/crypttab&lt;/code> gets two lines.
&lt;code>wyse-system&lt;/code> is partition 4, with &lt;code>discard&lt;/code>, so that the weekly trim still reaches the SSD.
Its &lt;code>x-initrd.attach&lt;/code> tells systemd that the initrd opens it, so that the regular shutdown does not try to close it while &lt;code>/&lt;/code> still uses it.
&lt;code>wyse-swap&lt;/code> formats partition 3 as swap with a new random key at every boot.&lt;/li>
&lt;li>The installer&amp;rsquo;s swap line in &lt;code>/etc/fstab&lt;/code> gives way to &lt;code>/dev/mapper/wyse-swap&lt;/code>.
The old file stays as &lt;code>/etc/fstab.before-luks&lt;/code>.&lt;/li>
&lt;li>&lt;code>/etc/dracut.conf.d/90-dell-wyse.conf&lt;/code> gets &lt;code>hostonly=&amp;quot;yes&amp;quot;&lt;/code>.
Ubuntu&amp;rsquo;s default initrd is generic and ignores crypttab; a host-only one carries the &lt;code>wyse-system&lt;/code> line.
&lt;a href="#57-unlocking-the-system-disk-over-ssh">Section 5.7&lt;/a> replaces the file with the repository&amp;rsquo;s version.&lt;/li>
&lt;li>The initrd is rebuilt, and a check confirms that the &lt;code>wyse-system&lt;/code> line made it in.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ol>
&lt;p>The BTRFS UUID survives the encryption, so the installer&amp;rsquo;s root entry in &lt;code>/etc/fstab&lt;/code> and GRUB&amp;rsquo;s &lt;code>root=&lt;/code> stay valid.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Set the target disk (whole disk, no -partN suffix) and the system partition&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">DISK&lt;/span>&lt;span class="o">=&lt;/span>/dev/disk/by-id/ata-Verbatim_Vi560_493653348990842
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">SYS&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part4
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Check that this is the prepared BTRFS partition and that nothing is mounted or used as swap&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -o NAME,SIZE,PARTLABEL,FSTYPE,LABEL,MOUNTPOINTS &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME SIZE PARTLABEL FSTYPE LABEL MOUNTPOINTS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sda 1.9T &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda1 1G wyse-efi vfat WYSE_EFI &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda2 2G wyse-boot ext4 &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-sda3 8G wyse-swap swap &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># `-sda4 64G wyse-system btrfs wyse-system&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">swapoff -a
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Remember the BTRFS UUID; it must survive the encryption&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">POOL_UUID&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>blkid -o value -s UUID &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$SYS&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$POOL_UUID&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 51c948e0-74f2-4f5c-b5e3-90b06f3b421f&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Make room: mount the top level, shrink the BTRFS pool by 1 GiB and unmount&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">MNT&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>mktemp -d&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mount -o &lt;span class="nv">subvolid&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="m">5&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$SYS&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">btrfs filesystem resize -1G &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Resize device id 1 (/dev/sda4) from 64.00GiB to 63.00GiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">umount &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Encrypt the partition in place (takes about 6 minutes).&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Enter a new, long passphrase when asked.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># If interrupted with Ctrl-C, continue with: cryptsetup reencrypt --resume-only &amp;#34;$SYS&amp;#34;.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># After a crash or power loss, set DISK and SYS again and run cryptsetup repair &amp;#34;$SYS&amp;#34; first.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cryptsetup reencrypt --encrypt --type luks2 --reduce-device-size 32M &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$SYS&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># WARNING!&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ========&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># This will overwrite data on LUKS2-temp-b06d573e-c4d7-4696-80e5-58d2ce2bf9a3.new irrevocably.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Are you sure? (Type &amp;#39;yes&amp;#39; in capital letters): YES&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Enter passphrase for LUKS2-temp-b06d573e-c4d7-4696-80e5-58d2ce2bf9a3.new: &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Verify passphrase: &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Finished, time 06m18s, 63 GiB written, speed 172.9 MiB/s&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Change the LUKS label&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cryptsetup config --label wyse-system-luks &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$SYS&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Grow partition 4 over the rest of the SSD and let the kernel re-read the partition table&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">parted -s &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> resizepart &lt;span class="m">4&lt;/span> 100%
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">partprobe &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">udevadm settle
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Open the LUKS container, grow it to the new partition size and grow the BTRFS pool to fill it&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cryptsetup open &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$SYS&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> wyse-system
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cryptsetup resize wyse-system &lt;span class="c1"># may ask for the passphrase again&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mount -o &lt;span class="nv">subvolid&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="m">5&lt;/span> /dev/mapper/wyse-system &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">btrfs filesystem resize max &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Verify: the BTRFS UUID must be unchanged (both lines must be identical)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">findmnt -n -o UUID --target &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 51c948e0-74f2-4f5c-b5e3-90b06f3b421f&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$POOL_UUID&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 51c948e0-74f2-4f5c-b5e3-90b06f3b421f&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">umount &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Mount the installed system (default subvolume @root), /boot and /boot/efi&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mount /dev/mapper/wyse-system &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/etc/fstab&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mount &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part2 &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/boot&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mount &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1 &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/boot/efi&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Make the virtual filesystems available inside the chroot&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">for&lt;/span> d in dev proc sys run&lt;span class="p">;&lt;/span> &lt;span class="k">do&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> mount --rbind &lt;span class="s2">&amp;#34;/&lt;/span>&lt;span class="nv">$d&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/&lt;/span>&lt;span class="nv">$d&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> mount --make-rslave &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/&lt;/span>&lt;span class="nv">$d&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">done&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Read the identifiers needed for crypttab and check that neither is empty&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">LUKS_UUID&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>cryptsetup luksUUID &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$SYS&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">SWAP_PARTUUID&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>blkid -o value -s PARTUUID &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part3&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$LUKS_UUID&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$SWAP_PARTUUID&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># b06d573e-c4d7-4696-80e5-58d2ce2bf9a3 86bab1f0-4492-4e4a-a859-b0bdb6b6286a&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Back up fstab, then replace the installer&amp;#39;s swap line with the encrypted swap&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cp -a &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/etc/fstab&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/etc/fstab.before-luks&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">grep -v -E &lt;span class="s1">&amp;#39;^[^#[:space:]]+[[:space:]]+(none|swap)[[:space:]]+swap[[:space:]]&amp;#39;&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/etc/fstab.before-luks&amp;#34;&lt;/span> &amp;gt; &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/etc/fstab&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> &lt;span class="s1">&amp;#39;/dev/mapper/wyse-swap none swap sw 0 0&amp;#39;&lt;/span> &amp;gt;&amp;gt; &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/etc/fstab&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Add the system volume and the random-key swap to crypttab&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">printf&lt;/span> &lt;span class="s1">&amp;#39;%s\n&amp;#39;&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s2">&amp;#34;wyse-system UUID=&lt;/span>&lt;span class="nv">$LUKS_UUID&lt;/span>&lt;span class="s2"> none luks,discard,x-initrd.attach&amp;#34;&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s2">&amp;#34;wyse-swap PARTUUID=&lt;/span>&lt;span class="nv">$SWAP_PARTUUID&lt;/span>&lt;span class="s2"> /dev/urandom swap,cipher=aes-xts-plain64,size=512&amp;#34;&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &amp;gt;&amp;gt; &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/etc/crypttab&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Wipe the old swap signature, so nothing finds and activates the old unencrypted swap by its UUID&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">wipefs -a &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part3
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Build a host-only initrd, which carries the wyse-system crypttab line&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mkdir -p &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/etc/dracut.conf.d&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> &lt;span class="s1">&amp;#39;hostonly=&amp;#34;yes&amp;#34;&amp;#39;&lt;/span> &amp;gt; &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">/etc/dracut.conf.d/90-dell-wyse.conf&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">chroot &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> update-initramfs -u -k all
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Verify: every installed kernel&amp;#39;s initrd must contain the wyse-system line&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># wyse-system UUID=... none luks,discard,x-initrd.attach (one line per kernel; if one is missing, do not reboot)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">for&lt;/span> v in &lt;span class="k">$(&lt;/span>chroot &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> linux-version list&lt;span class="k">)&lt;/span>&lt;span class="p">;&lt;/span> &lt;span class="k">do&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> chroot &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> lsinitrd -f etc/crypttab &lt;span class="s2">&amp;#34;/boot/initrd.img-&lt;/span>&lt;span class="nv">$v&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="p">|&lt;/span> grep &lt;span class="s1">&amp;#39;^wyse-system &amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">done&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># wyse-system /dev/disk/by-uuid/b06d573e-c4d7-4696-80e5-58d2ce2bf9a3 none luks,discard,x-initrd.attach&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># wyse-system /dev/disk/by-uuid/b06d573e-c4d7-4696-80e5-58d2ce2bf9a3 none luks,discard,x-initrd.attach&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Clean up and close the LUKS container&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">umount -R &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rmdir &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$MNT&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cryptsetup close wyse-system
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then remove the USB stick and reboot:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">reboot now
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="34-first-encrypted-boot">3.4 First encrypted boot&lt;/h3>
&lt;p>Ubuntu now stops at a passphrase prompt for &lt;code>wyse-system&lt;/code> on the console; type it there.
Until &lt;a href="#57-unlocking-the-system-disk-over-ssh">section 5.7&lt;/a> sets up the SSH unlock, every boot waits for it at the console.
After booting, check the result:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">findmnt -no SOURCE,FSTYPE,FSROOT /
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/mapper/wyse-system[/@root] btrfs /@root&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME SIZE TYPE FSTYPE MOUNTPOINTS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop0 13.2M loop squashfs /snap/canonical-livepatch/418&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop1 74M loop squashfs /snap/core22/3129&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop2 66.8M loop squashfs /snap/core24/1643&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop3 50.1M loop squashfs /snap/snapd/27710&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop4 1.5M loop squashfs /snap/hwctl/123&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># loop5 32.5M loop squashfs /snap/snapd/28332&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sda 1.9T disk &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─sda1 1G part vfat /boot/efi&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─sda2 2G part ext4 /boot&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─sda3 8G part &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># │ └─wyse-swap 8G crypt swap [SWAP]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─sda4 1.9T part crypto_LUKS &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─wyse-system 1.9T crypt btrfs /&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mmcblk0 29.1G disk btrfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mmcblk0boot0 4M disk &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mmcblk0boot1 4M disk&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cryptsetup status wyse-system
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/mapper/wyse-system is active and is in use.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># type: LUKS2&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># cipher: aes-xts-plain64&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># keysize: 512 [bits]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># key location: keyring&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># device: /dev/sda4&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sector size: 512 [bytes]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># offset: 32768 [512-byte units] (16777216 [bytes])&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># size: 3977693839 [512-byte units] (2036579245568 [bytes])&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># mode: read/write&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># flags: discards &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">swapon --show
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME TYPE SIZE USED PRIO&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/dm-1 partition 8G 0B -1&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Expected output:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>&lt;code>findmnt&lt;/code>:&lt;/strong> &lt;code>/&lt;/code> comes from &lt;code>/dev/mapper/wyse-system&lt;/code>, with &lt;code>/@root&lt;/code>.&lt;/li>
&lt;li>&lt;strong>&lt;code>lsblk&lt;/code>:&lt;/strong> partition 4 is &lt;code>crypto_LUKS&lt;/code>, with &lt;code>wyse-system&lt;/code> and its BTRFS pool inside, about 1.9T.
Partition 3 carries &lt;code>wyse-swap&lt;/code>, about 8G.&lt;/li>
&lt;li>&lt;strong>&lt;code>cryptsetup status&lt;/code>:&lt;/strong> LUKS2, with &lt;code>discards&lt;/code> among its flags.&lt;/li>
&lt;li>&lt;strong>&lt;code>swapon&lt;/code>:&lt;/strong> a &lt;code>/dev/dm-…&lt;/code> device, which is &lt;code>wyse-swap&lt;/code>.&lt;/li>
&lt;/ul>
&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Optional: back up the SSD&amp;rsquo;s LUKS header to your password manager.&lt;/strong>
Export the LUKS header on the Wyse:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo cryptsetup luksHeaderBackup /dev/disk/by-partlabel/wyse-system &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --header-backup-file ~/dell-wyse-system-luks-header.img
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo chown &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$USER&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> ~/dell-wyse-system-luks-header.img
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Copy the header backup to your Mac with &lt;code>scp&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">scp &amp;lt;user&amp;gt;@dell-wyse:dell-wyse-system-luks-header.img ~/Downloads/
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Attach &lt;code>~/Downloads/dell-wyse-system-luks-header.img&lt;/code> to the same entry as the passphrase in your password manager.
If the header on the disk is ever damaged, that file and the passphrase are the only way back in.
Then delete the local copy on the &lt;strong>Mac&lt;/strong>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">rm ~/Downloads/dell-wyse-system-luks-header.img
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Finally, delete the file on the &lt;strong>Wyse&lt;/strong> (over SSH or at the console):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">rm ~/dell-wyse-system-luks-header.img
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;/div>
&lt;/div>
&lt;h2 id="4-mount-the-other-subvolumes-before-installing-docker">4 Mount the other subvolumes before installing Docker&lt;/h2>
&lt;p>At the &lt;strong>local console&lt;/strong> of the fresh Ubuntu, install the editor and the BTRFS tools, then copy the initial home directory, including hidden files and imported keys.
Enter the commands one by one in the same terminal session, because they rely on the &lt;code>POOL_UUID&lt;/code> shell variable.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Install the editor and BTRFS tools&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt update
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt install --no-install-recommends btrfs-progs -y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Read the UUID of the BTRFS pool that holds /&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">POOL_UUID&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>findmnt -n -o UUID /&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$POOL_UUID&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 51c948e0-74f2-4f5c-b5e3-90b06f3b421f&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create the mount points and mount the top level of the pool (subvolid=5)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mkdir -p /mnt/wyse-top /var/lib/docker /var/lib/containerd /srv/nextcloud /srv/ha-backups
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mount -o &lt;span class="nv">subvolid&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="m">5&lt;/span> &lt;span class="s2">&amp;#34;UUID=&lt;/span>&lt;span class="nv">$POOL_UUID&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> /mnt/wyse-top
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls /mnt/wyse-top
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># @containerd @docker @ha-backups @home @nextcloud @root @snapshots&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Check that the target directories and the new @home subvolume are empty&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls -A /mnt/wyse-top/@home /var/lib/docker /var/lib/containerd /srv/nextcloud /srv/ha-backups
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /mnt/wyse-top/@home:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /srv/ha-backups:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /srv/nextcloud:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /var/lib/containerd:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /var/lib/docker:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Copy the initial home directory, including hidden files and imported keys, into @home&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cp -a --reflink&lt;span class="o">=&lt;/span>auto /home/. /mnt/wyse-top/@home/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ls -la /mnt/wyse-top/@home
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># total 16&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># drwxr-xr-x 1 root root 16 Nov 16 08:53 .&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># drwxr-xr-x 1 root root 118 Nov 16 08:42 ..&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># drwxr-x--- 1 wmutschl wmutschl 100 Nov 16 09:46 wmutschl&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Back up fstab and unmount the top level again&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cp -a /etc/fstab /etc/fstab.before-nextcloud
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo umount /mnt/wyse-top
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cat /etc/fstab
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># # &amp;lt;file system&amp;gt; &amp;lt;mount point&amp;gt; &amp;lt;type&amp;gt; &amp;lt;options&amp;gt; &amp;lt;dump&amp;gt; &amp;lt;pass&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># # / was on /dev/sda4 during curtin installation&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/disk/by-uuid/51c948e0-74f2-4f5c-b5e3-90b06f3b421f / btrfs defaults 0 1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># # /boot was on /dev/sda2 during curtin installation&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/disk/by-uuid/b6f36e34-7f7a-4443-8c7c-09e168af28e4 /boot ext4 defaults 0 1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># # /boot/efi was on /dev/sda1 during curtin installation&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/disk/by-uuid/1271-8172 /boot/efi vfat defaults 0 1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/mapper/wyse-swap none swap sw 0 0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Replace the installer&amp;#39;s root entry (the btrfs line for /) with one that selects the @root subvolume&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo sed -i -E &lt;span class="s2">&amp;#34;s|^[^#[:space:]]+[[:space:]]+/[[:space:]]+btrfs[[:space:]].*|UUID=&lt;/span>&lt;span class="nv">$POOL_UUID&lt;/span>&lt;span class="s2"> / btrfs defaults,noatime,subvol=@root,compress=zstd:3 0 0|&amp;#34;&lt;/span> /etc/fstab
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Add the other six entries&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo tee -a /etc/fstab &amp;gt;/dev/null &lt;span class="s">&amp;lt;&amp;lt;EOF
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">UUID=$POOL_UUID /home btrfs defaults,noatime,subvol=@home,compress=zstd:3 0 0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">UUID=$POOL_UUID /var/lib/docker btrfs defaults,noatime,subvol=@docker,compress=zstd:3 0 0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">UUID=$POOL_UUID /var/lib/containerd btrfs defaults,noatime,subvol=@containerd,compress=zstd:3 0 0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">UUID=$POOL_UUID /srv/nextcloud btrfs defaults,noatime,subvol=@nextcloud,compress=zstd:3 0 0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">UUID=$POOL_UUID /srv/ha-backups btrfs defaults,noatime,subvol=@ha-backups,compress=zstd:3 0 0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">UUID=$POOL_UUID /mnt/wyse-top btrfs defaults,noatime,subvolid=5,compress=zstd:3 0 0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Show the result&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cat /etc/fstab
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># # &amp;lt;file system&amp;gt; &amp;lt;mount point&amp;gt; &amp;lt;type&amp;gt; &amp;lt;options&amp;gt; &amp;lt;dump&amp;gt; &amp;lt;pass&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UUID=51c948e0-74f2-4f5c-b5e3-90b06f3b421f / btrfs defaults,noatime,subvol=@root,compress=zstd:3 0 0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/disk/by-uuid/b6f36e34-7f7a-4443-8c7c-09e168af28e4 /boot ext4 defaults 0 1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/disk/by-uuid/1271-8172 /boot/efi vfat defaults 0 1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /dev/mapper/wyse-swap none swap sw 0 0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UUID=51c948e0-74f2-4f5c-b5e3-90b06f3b421f /home btrfs defaults,noatime,subvol=@home,compress=zstd:3 0 0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UUID=51c948e0-74f2-4f5c-b5e3-90b06f3b421f /var/lib/docker btrfs defaults,noatime,subvol=@docker,compress=zstd:3 0 0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UUID=51c948e0-74f2-4f5c-b5e3-90b06f3b421f /var/lib/containerd btrfs defaults,noatime,subvol=@containerd,compress=zstd:3 0 0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UUID=51c948e0-74f2-4f5c-b5e3-90b06f3b421f /srv/nextcloud btrfs defaults,noatime,subvol=@nextcloud,compress=zstd:3 0 0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UUID=51c948e0-74f2-4f5c-b5e3-90b06f3b421f /srv/ha-backups btrfs defaults,noatime,subvol=@ha-backups,compress=zstd:3 0 0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UUID=51c948e0-74f2-4f5c-b5e3-90b06f3b421f /mnt/wyse-top btrfs defaults,noatime,subvolid=5,compress=zstd:3 0 0&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Check the output of &lt;code>cat /etc/fstab&lt;/code>:&lt;/p>
&lt;ul>
&lt;li>There is exactly &lt;strong>one&lt;/strong> &lt;code>/&lt;/code> line.
It has &lt;code>subvol=@root&lt;/code> and your pool UUID, and the installer&amp;rsquo;s old root line is gone.&lt;/li>
&lt;li>All seven BTRFS lines (&lt;code>/&lt;/code>, &lt;code>/home&lt;/code>, &lt;code>/var/lib/docker&lt;/code>, &lt;code>/var/lib/containerd&lt;/code>, &lt;code>/srv/nextcloud&lt;/code>, &lt;code>/srv/ha-backups&lt;/code>, &lt;code>/mnt/wyse-top&lt;/code>) carry the &lt;strong>same&lt;/strong> UUID, the one printed by &lt;code>echo &amp;quot;$POOL_UUID&amp;quot;&lt;/code>.
It must not be empty, so there is no &lt;code>UUID= /&lt;/code> anywhere.&lt;/li>
&lt;li>The entries for EFI (&lt;code>/boot/efi&lt;/code>) and &lt;code>/boot&lt;/code> are still there, and so is the &lt;code>/dev/mapper/wyse-swap&lt;/code> line from &lt;a href="#33-encrypt-the-system-partition-in-place">section 3.3&lt;/a>.&lt;/li>
&lt;li>The &lt;code>/mnt/wyse-top&lt;/code> line has &lt;code>subvolid=5&lt;/code> and no &lt;code>subvol=&lt;/code>; every other BTRFS line has &lt;code>subvol=@...&lt;/code>.
This line mounts the filesystem&amp;rsquo;s top level, where BTRBK sees all subvolumes side by side and keeps its snapshots in &lt;code>@snapshots&lt;/code>.&lt;/li>
&lt;li>There is intentionally no &lt;code>nofail&lt;/code> for the production data mounts.&lt;/li>
&lt;li>&lt;code>noatime&lt;/code> avoids a metadata write on every read, which otherwise also makes snapshots diverge for no reason.&lt;/li>
&lt;li>If something is wrong, restore the backup with &lt;code>sudo cp -a /etc/fstab.before-nextcloud /etc/fstab&lt;/code>.&lt;/li>
&lt;/ul>
&lt;p>Validate and mount before proceeding:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo systemctl daemon-reload
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo findmnt --verify --verbose
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Success, no errors or warnings detected&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mount /home
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mount /var/lib/docker
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mount /var/lib/containerd
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mount /srv/nextcloud
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mount /srv/ha-backups
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mount /mnt/wyse-top
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">findmnt -t btrfs -o TARGET,FSROOT,OPTIONS
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># TARGET FSROOT OPTIONS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># / /@root rw,relatime,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@root&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─/home /@home rw,noatime,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@home&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─/var/lib/docker /@docker rw,noatime,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/@docker&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─/var/lib/containerd /@containerd rw,noatime,ssd,discard=async,space_cache=v2,subvolid=259,subvol=/@containerd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─/srv/nextcloud /@nextcloud rw,noatime,ssd,discard=async,space_cache=v2,subvolid=260,subvol=/@nextcloud&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─/srv/ha-backups /@ha-backups rw,noatime,ssd,discard=async,space_cache=v2,subvolid=261,subvol=/@ha-backups&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─/mnt/wyse-top / rw,noatime,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls -la /home
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># total 0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># drwxr-xr-x 1 root root 16 Nov 16 08:53 .&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># drwxr-xr-x 1 root root 150 Nov 16 08:48 ..&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># drwxr-x--- 1 wmutschl wmutschl 100 Nov 16 09:46 wmutschl&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Confirm that every path maps to its intended subvolume and that the administrator&amp;rsquo;s home kept its owner.
Do not use this fresh-install procedure to mount an empty subvolume over an existing Docker installation.
Reboot once and check again; the reboot also applies the new mount options of &lt;code>/&lt;/code>, which still shows &lt;code>relatime&lt;/code> above.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo reboot now
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Optional: remove the hidden copy of &lt;code>/home&lt;/code> on &lt;code>@root&lt;/code>.&lt;/strong>
The initial &lt;code>/home&lt;/code> copy on &lt;code>@root&lt;/code> remains hidden beneath the &lt;code>/home&lt;/code> mount, and only the copy on &lt;code>@home&lt;/code> is in use.
After the reboot, check that &lt;code>/home&lt;/code> really comes from &lt;code>@home&lt;/code> and that it matches the hidden original.
This is optional, and the data is tiny, but it frees the hidden copy and avoids confusion later.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /home must come from the @home subvolume&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">findmnt -no FSROOT /home
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /@home&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Compare the original (hidden) home on @root with the live home on @home&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo diff -r /mnt/wyse-top/@root/home/&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$USER&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> /home/&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$USER&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># no output means identical; small differences in .bash_history, .cache or .local are expected&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># because you have used the shell since the copy; files missing from /home/$USER (e.g. under .ssh) are not&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Only if &lt;code>/home&lt;/code> shows &lt;code>/@home&lt;/code> and nothing important is missing from &lt;code>/home/$USER&lt;/code>, it is safe to delete the hidden copy.
This removes everything &lt;em>inside&lt;/em> your hidden home directory on &lt;code>@root&lt;/code>, but keeps the directory itself, which is not used anymore.
Do &lt;strong>not&lt;/strong> touch &lt;code>/home/$USER&lt;/code> itself:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Delete the contents of the hidden home on @root, not the directory&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo find /mnt/wyse-top/@root/home/&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$USER&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> -mindepth &lt;span class="m">1&lt;/span> -delete
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Verify: the hidden directory is empty and your real home is untouched&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ls -A /mnt/wyse-top/@root/home/&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$USER&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="c1"># no output&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls -A /home/&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$USER&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># .bash_history .bash_logout .bashrc .cache .profile .ssh&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;/div>
&lt;/div>
&lt;h2 id="5-update-and-harden-the-ubuntu-host">5 Update and harden the Ubuntu host&lt;/h2>
&lt;h3 id="51-packages-updates-and-disk-health">5.1 Packages, updates and disk health&lt;/h3>
&lt;p>Connect to the Wyse via SSH and enter the commands one by one:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Update the package lists and install all pending updates&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt update
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt full-upgrade -y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Install the tools used in the rest of this guide&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt install --no-install-recommends -y &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> ca-certificates curl git openssh-server ufw unattended-upgrades &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> apparmor apparmor-utils smartmontools rsync btrfs-progs nano less python3
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Turn on automatic security updates: answer Yes when prompted&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo dpkg-reconfigure --priority&lt;span class="o">=&lt;/span>low unattended-upgrades
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Keep automatic reboots disabled (see the explanation below)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo tee /etc/apt/apt.conf.d/52-local-reboot-policy &amp;gt;/dev/null &lt;span class="s">&amp;lt;&amp;lt;&amp;#39;APT&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Unattended-Upgrade::Automatic-Reboot &amp;#34;false&amp;#34;;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">APT&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">apt-config dump &lt;span class="p">|&lt;/span> grep Automatic-Reboot
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Unattended-Upgrade::Automatic-Reboot &amp;#34;false&amp;#34;;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Check that the automatic update timers are scheduled&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl list-timers &lt;span class="s1">&amp;#39;apt-daily*&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># apt-daily.timer and apt-daily-upgrade.timer, each with a NEXT time&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Enable the weekly TRIM for the SSD and check it&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl &lt;span class="nb">enable&lt;/span> --now fstrim.timer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl list-timers fstrim.timer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># fstrim.timer with a NEXT time&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Check that AppArmor is running&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl is-active apparmor
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># active&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo aa-status &lt;span class="p">|&lt;/span> grep apparmor
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># apparmor module is loaded.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Set the time zone to Europe/Berlin&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo timedatectl set-timezone Europe/Berlin
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Check the time zone and the clock&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">timedatectl status
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Automatic reboots stay off, because every boot waits for the passphrase over SSH (set up below).
When &lt;code>/var/run/reboot-required&lt;/code> appears, reboot soon, at a time when you can unlock the disk.
Unattended upgrades install only Ubuntu&amp;rsquo;s own security updates; Docker, Tailscale and the Nextcloud AIO containers are updated separately (&lt;a href="#106-updates">section 10.6&lt;/a>).
Leave AppArmor and the kernel&amp;rsquo;s security defaults as they are: broad CIS or sysctl hardening templates, disabling IPv6 or remounting Docker&amp;rsquo;s storage &lt;code>noexec&lt;/code> can break this setup.&lt;/p>
&lt;p>Next, check the SSD&amp;rsquo;s health in its SMART report, using its whole-disk path.
Resolve any media errors before you trust the disk with your data.
A clean report is no guarantee for the future and no substitute for backups; &lt;a href="#74-disk-health-monthly-scrub-and-smart-monitoring">section 7.4&lt;/a> adds continuous SMART monitoring.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Set the whole-disk path of the Vi560 again (the same as in section 3.1; use the TAB key to complete the path)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">DISK&lt;/span>&lt;span class="o">=&lt;/span>/dev/disk/by-id/ata-Verbatim_Vi560_493653348990842
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Quick health verdict&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo smartctl -H &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># SMART overall-health self-assessment test result: PASSED&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Full report: look at the error log and the attributes&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo smartctl -a &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># no entries in the error log, and no reallocated, pending or uncorrectable sectors&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Optional: run a baseline SMART self-test.&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo smartctl -t short &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="c1"># wait about 2 minutes&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo smartctl -l selftest &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$DISK&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># === START OF READ SMART DATA SECTION ===&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># SMART Self-test log structure revision number 1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># # 1 Short offline Completed without error 00% 24998 -&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;/div>
&lt;/div>
&lt;h3 id="52-ubuntu-pro-and-livepatch">5.2 Ubuntu Pro and Livepatch&lt;/h3>
&lt;p>Ubuntu Pro is free for personal use on up to five machines.
Attaching a machine adds two things:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>ESM&lt;/strong> extends security updates to the universe packages this host uses, such as BTRBK, and unattended-upgrades installs them like the others.&lt;/li>
&lt;li>&lt;strong>Livepatch&lt;/strong> applies fixes for high and critical kernel vulnerabilities to the running kernel, without a reboot.
That fits the no-automatic-reboot policy above: reboots for new kernels are still needed, but no longer urgent.
On an LTS release, Livepatch is enabled automatically on attach.&lt;/li>
&lt;/ul>
&lt;p>If you did not attach the machine during the installation, run:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo pro attach
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Check the status with &lt;code>pro status&lt;/code>, which should list &lt;code>esm-apps&lt;/code>, &lt;code>esm-infra&lt;/code> and &lt;code>livepatch&lt;/code> as enabled.
The Livepatch status should report the running kernel as supported.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">pro status
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># SERVICE ENTITLED STATUS DESCRIPTION&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># anbox-cloud yes disabled Scalable Android in the cloud&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># esm-apps yes enabled Expanded Security Maintenance for Applications&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># esm-infra yes enabled Expanded Security Maintenance for Infrastructure&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># landscape yes disabled Management and administration tool for Ubuntu&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># livepatch yes enabled Canonical Livepatch service&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo canonical-livepatch status --verbose
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># last check: 10 minutes ago&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># kernel: 7.0.0-43.43-generic&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># server check-in: succeeded&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># kernel state: ✓ kernel series 7.0 is covered by Livepatch&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># patch state: ✓ no livepatches available for kernel 7.0.0-43.43-generic&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># tier: updates (Free usage; This machine beta tests new patches.)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># machine id: XYZ&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># client version: v11.1.0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># architecture: amd64&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># cpu model: Intel(R) Celeron(R) J4105 CPU @ 1.50GHz&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># boot time: 12 minutes ago&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="53-the-scripts-repository">5.3 The scripts repository&lt;/h3>
&lt;p>My &lt;a href="https://github.com/wmutschl/scripts" target="_blank" rel="noopener">scripts repository&lt;/a> is the source of truth for the deployment and the host configuration of my machines.
Clone it:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">git clone https://github.com/wmutschl/scripts.git ~/scripts
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>In &lt;code>scripts/Dell-Wyse-Thin-Client-5070/&lt;/code>, the folders &lt;code>etc/&lt;/code> and &lt;code>usr/&lt;/code> mirror the host&amp;rsquo;s file system: for example, &lt;code>scripts/Dell-Wyse-Thin-Client-5070/etc/smartd.conf&lt;/code> belongs at &lt;code>/etc/smartd.conf&lt;/code>.
The folder&amp;rsquo;s top level holds the compose file, its &lt;code>.env&lt;/code> template &lt;code>dell-wyse.env&lt;/code>, and the template &lt;code>host.env.example&lt;/code> for &lt;code>/etc/dell-wyse&lt;/code>; the sidecar&amp;rsquo;s serve configuration lives in &lt;code>scripts/Tailscale/&lt;/code>.
The sections that need these files copy them into place with &lt;code>install&lt;/code>, which also sets owner and mode.
To change the host configuration later, edit the file in the repository, pull, and run its &lt;code>install&lt;/code> line again in &lt;code>~/scripts/Dell-Wyse-Thin-Client-5070&lt;/code>, along with the reload or restart that follows it.
&lt;a href="#102-host-configuration-and-recovery-material">Section 10.2&lt;/a> shows how to compare the host with the repository.&lt;/p>
&lt;h3 id="54-simple-wired-networking">5.4 Simple wired networking&lt;/h3>
&lt;p>Keep the installer&amp;rsquo;s DHCP configuration on the onboard network interface.
In the FRITZ!Box, check that &lt;code>192.168.178.55&lt;/code> is free and reserve it for the Wyse&amp;rsquo;s MAC address.
Confirm the actual interface name, address, gateway and DNS:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">ip -br link
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ip -br addr
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ip route
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo netplan get
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">getent hosts mutschler.dev &lt;span class="c1"># simple DNS check&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">curl -I https://mutschler.dev &lt;span class="c1"># simple connectivity check&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If network changes are needed, edit the existing Netplan definition at the physical console, save a copy first, validate with &lt;code>sudo netplan generate&lt;/code> and apply with &lt;code>sudo netplan try --timeout 120&lt;/code>.
Do not configure several Ethernet adapters with competing default routes, and keep IPv6 enabled.&lt;/p>
&lt;h3 id="55-key-only-ssh-verified-before-password-login-is-disabled">5.5 Key-only SSH, verified before password login is disabled&lt;/h3>
&lt;p>At the &lt;strong>Ubuntu console&lt;/strong>, print the fingerprint of the host key:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>On the &lt;strong>Mac&lt;/strong>, compare it with the fingerprint that ssh shows at the first connection.
If you have connected before, for example in &lt;a href="#32-install-ubuntu">section 3.2&lt;/a>, compare it with the stored key instead: &lt;code>ssh-keygen -lF 192.168.178.55&lt;/code>.
If the public key was not imported during the installation, install it with the initial account password as follows; adjust the login, the key file names and the IP address:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">cat ~/.ssh/id_ed25519.pub &lt;span class="p">|&lt;/span> ssh wmutschl@192.168.178.55 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s1">&amp;#39;umask 077; mkdir -p ~/.ssh; cat &amp;gt;&amp;gt; ~/.ssh/authorized_keys&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ssh -o &lt;span class="nv">IdentitiesOnly&lt;/span>&lt;span class="o">=&lt;/span>yes -o &lt;span class="nv">PreferredAuthentications&lt;/span>&lt;span class="o">=&lt;/span>publickey &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -i ~/.ssh/id_ed25519 wmutschl@192.168.178.55
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Keep that working session open.&lt;/p>
&lt;p>On &lt;strong>Ubuntu&lt;/strong>, install the early configuration drop-in &lt;code>/etc/ssh/sshd_config.d/00-local-hardening.conf&lt;/code> from the repository and check the effective result.
It disables root and password login, X11 and agent forwarding, and allows only local TCP forwarding:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -D -m &lt;span class="m">0644&lt;/span> etc/ssh/sshd_config.d/00-local-hardening.conf /etc/ssh/sshd_config.d/00-local-hardening.conf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo sshd -t &lt;span class="o">&amp;amp;&amp;amp;&lt;/span> sudo systemctl reload ssh
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo sshd -T &lt;span class="p">|&lt;/span> grep -E &lt;span class="s1">&amp;#39;^(permitrootlogin|pubkeyauthentication|passwordauthentication|kbdinteractiveauthentication|x11forwarding|allowagentforwarding|allowtcpforwarding) &amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># permitrootlogin no&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># pubkeyauthentication yes&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># passwordauthentication no&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># kbdinteractiveauthentication no&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># x11forwarding no&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># allowtcpforwarding local&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># allowagentforwarding no&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Local TCP forwarding remains enabled for the break-glass tunnel to the Nextcloud AIO interface.
Keep the console password for local recovery and &lt;code>sudo&lt;/code>; SSH no longer accepts it.
See Ubuntu&amp;rsquo;s &lt;a href="https://documentation.ubuntu.com/server/how-to/security/openssh-server/" target="_blank" rel="noopener">OpenSSH server guide&lt;/a> for more details.&lt;/p>
&lt;h3 id="56-firewall-and-service-exposure">5.6 Firewall and service exposure&lt;/h3>
&lt;p>From the local console, allow SSH only from your trusted LAN, then enable UFW.
Substitute the observed name of the onboard interface if it is not &lt;code>enp1s0&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo ufw default deny incoming
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ufw default allow outgoing
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ufw allow in on enp1s0 from 192.168.178.0/24 to any port &lt;span class="m">22&lt;/span> proto tcp
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ufw &lt;span class="nb">enable&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ufw status verbose
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Status: active&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Logging: on (low)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Default: deny (incoming), allow (outgoing), disabled (routed)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># New profiles: skip&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># To Action From&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># -- ------ ----&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 22/tcp on enp1s0 ALLOW IN 192.168.178.0/24 &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># List every port the machine is listening on, together with the program that owns it&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ss -lntup
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># udp UNCONN 0 0 127.0.0.54:53 0.0.0.0:* users:((&amp;#34;systemd-resolve&amp;#34;,pid=1349,fd=18)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:((&amp;#34;systemd-resolve&amp;#34;,pid=1349,fd=16)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># udp UNCONN 0 0 192.168.178.55%enp1s0:68 0.0.0.0:* users:((&amp;#34;systemd-network&amp;#34;,pid=1784,fd=37)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># udp UNCONN 0 0 127.0.0.1:323 0.0.0.0:* users:((&amp;#34;chronyd&amp;#34;,pid=1946,fd=4)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># udp UNCONN 0 0 [::1]:323 [::]:* users:((&amp;#34;chronyd&amp;#34;,pid=1946,fd=5)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># udp UNCONN 0 0 [fe80::2e0:4cff:fe00:55]%enp1s0:546 [::]:* users:((&amp;#34;systemd-network&amp;#34;,pid=1784,fd=36)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># tcp LISTEN 0 4096 0.0.0.0:22 0.0.0.0:* users:((&amp;#34;sshd&amp;#34;,pid=7164,fd=3),(&amp;#34;systemd&amp;#34;,pid=1,fd=194)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:((&amp;#34;systemd-resolve&amp;#34;,pid=1349,fd=17)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># tcp LISTEN 0 4096 127.0.0.54:53 0.0.0.0:* users:((&amp;#34;systemd-resolve&amp;#34;,pid=1349,fd=19)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># tcp LISTEN 0 4096 [::]:22 [::]:* users:((&amp;#34;sshd&amp;#34;,pid=7164,fd=4),(&amp;#34;systemd&amp;#34;,pid=1,fd=195)) &lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then confirm from the Mac that a new SSH connection still gets through.
In the &lt;code>ss&lt;/code> output, &lt;code>sshd&lt;/code> on port 22 is the only service listening beyond loopback; the UDP sockets on ports 68 and 546 belong to the DHCP clients for IPv4 and IPv6.
&lt;a href="#75-backup-share-for-home-assistant">Section 7.5&lt;/a> adds the only other rule, SMB from my Raspberry Pi.&lt;/p>
&lt;p>UFW only has to cover the LAN: Funnel provides the public HTTPS endpoint, so nothing is forwarded on the router.
However, two kinds of traffic bypass UFW entirely:&lt;/p>
&lt;ul>
&lt;li>Docker diverts traffic for published container ports before UFW sees it, which is why the deployment publishes nothing on the LAN (&lt;a href="#92-configure-the-deployment-on-the-wyse">section 9.2&lt;/a>).
See &lt;a href="https://docs.docker.com/engine/network/packet-filtering-firewalls/" target="_blank" rel="noopener">Docker&amp;rsquo;s firewall behavior&lt;/a> for more details.&lt;/li>
&lt;li>Tailnet traffic is governed by the tailnet policy instead (&lt;a href="#81-tailscale-admin-console">section 8.1&lt;/a>).
Traffic for Nextcloud arrives through the sidecar container, and traffic for the host itself is accepted by Tailscale on &lt;code>tailscale0&lt;/code> before UFW sees it.&lt;/li>
&lt;/ul>
&lt;div class="alert alert-note">
&lt;div>
&lt;strong>Talk stays on loopback.&lt;/strong>
If you enable Talk in Nextcloud AIO (&lt;a href="#932-path-a-set-up-nextcloud-aio">section 9.3.2&lt;/a>), its container publishes its TURN port 3478, TCP and UDP, without a host address.
Docker would normally bind such a port to all interfaces, past UFW.
The &lt;code>nextcloud-aio&lt;/code> network from the compose file binds it to &lt;code>127.0.0.1&lt;/code> instead (&lt;code>com.docker.network.bridge.host_binding_ipv4&lt;/code>), so Talk is exposed neither to the LAN nor to the tailnet.
The flip side: clients cannot reach Talk&amp;rsquo;s built-in TURN server either, so Talk would need an external one.
I don&amp;rsquo;t use Talk.
&lt;/div>
&lt;/div>
&lt;p>Finally, check which services run on the host:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">systemctl --type&lt;span class="o">=&lt;/span>service --state&lt;span class="o">=&lt;/span>running
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UNIT LOAD ACTIVE SUB DESCRIPTION &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># chrony.service loaded active running chrony, an NTP client/server&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># dbus.service loaded active running D-Bus System Message Bus&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># getty@tty1.service loaded active running Getty on tty1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># multipathd.service loaded active running Device-Mapper Multipath Device Controller&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># networkd-dispatcher.service loaded active running Dispatcher daemon for systemd-networkd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># polkit.service loaded active running Authorization Manager&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># smartmontools.service loaded active running Self Monitoring and Reporting Technology (SMART) Daemon&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># snap.canonical-livepatch.canonical-livepatchd.service loaded active running Service for snap application canonical-livepatch.canonical-livepatchd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># snapd.service loaded active running Snap Daemon&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ssh.service loaded active running OpenBSD Secure Shell server&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># systemd-journald.service loaded active running Journal Service&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># systemd-logind.service loaded active running User Login Management&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># systemd-networkd.service loaded active running Network Management&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># systemd-resolved.service loaded active running Network Name Resolution&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># systemd-udevd.service loaded active running Rule-based Manager for Device Events and Files&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># thermald.service loaded active running Thermal Daemon Service&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># unattended-upgrades.service loaded active running Unattended Upgrades Shutdown&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># user@1000.service loaded active running User Manager for UID 1000&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Legend: LOAD → Reflects whether the unit definition was properly loaded.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ACTIVE → The high-level unit activation state, i.e. generalization of SUB.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># SUB → The low-level unit activation state, values depend on unit type.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 18 loaded units listed.&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This installation needs no graphical login, printing, FTP, database or web server on the host; Nextcloud AIO brings its own database and web server in containers.
If one of them shows up, remove its package by name, and keep the networking, time synchronization and security services.
Avoid desktop clean-up recipes that purge packages by wildcard: they can remove essential packages along the way.&lt;/p>
&lt;h3 id="57-unlocking-the-system-disk-over-ssh">5.7 Unlocking the system disk over SSH&lt;/h3>
&lt;p>At every boot, &lt;code>systemd-cryptsetup&lt;/code> reads the &lt;code>wyse-system&lt;/code> line in &lt;code>/etc/crypttab&lt;/code> from &lt;a href="#33-encrypt-the-system-partition-in-place">section 3.3&lt;/a>, asks for the passphrase and waits.
You answer over &lt;strong>SSH into the initrd&lt;/strong> from the Mac, or at the console.
This is the 26.04 counterpart to &lt;code>dropbear-initramfs&lt;/code>.
That package is still in the archive, but it needs &lt;code>initramfs-tools&lt;/code>, which 26.04 replaced with dracut as the default and which Ubuntu intends to phase out.
Ubuntu packages no SSH module for dracut yet, so this guide uses &lt;a href="https://github.com/gsauthof/dracut-sshd" target="_blank" rel="noopener">dracut-sshd&lt;/a> instead: it runs the system&amp;rsquo;s own OpenSSH in the initrd and answers systemd&amp;rsquo;s own passphrase prompt, and its author tests it on 26.04.&lt;/p>
&lt;p>&lt;strong>What this protects, and what it costs:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Whenever the Wyse is off, the SSD is closed:&lt;/strong> dead, sent back under warranty, or stolen, on its own or together with the Wyse.&lt;/li>
&lt;li>&lt;strong>&lt;code>/boot&lt;/code> is not encrypted.&lt;/strong>
Someone with physical access could alter the initrd and capture the passphrase at the next unlock, as with any dropbear setup.&lt;/li>
&lt;li>&lt;strong>Every boot waits for you,&lt;/strong> including the one after a power cut.
Nextcloud and the backup jobs stay down until you unlock, and &lt;code>dell-wyse-alive&lt;/code> alerts within about six minutes (&lt;a href="#71-alerts-to-healthchecksio">section 7.1&lt;/a>).&lt;/li>
&lt;li>&lt;strong>The initrd answers on the LAN only,&lt;/strong> because Tailscale on the host starts only after the unlock.
Away from home, connect to a machine on the LAN and unlock from there.
For me, that is my Mac mini over Tailscale, or my Raspberry Pi with Home Assistant OS.
After a power cut, this works only if that machine starts by itself and rejoins the tailnet.
A Mac with FileVault, for example, first waits for its own password at boot, just like the Wyse.&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>SSH in the initrd.&lt;/strong> dracut-sshd is not packaged for Ubuntu, so clone its repository into your home directory and check out the release tag 0.7.1.
Read &lt;code>46sshd/module-setup.sh&lt;/code> before copying the module, because dracut runs it as root on every initrd build:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">git clone https://github.com/gsauthof/dracut-sshd.git ~/dracut-sshd
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/dracut-sshd
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">git checkout 0.7.1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">git rev-parse HEAD
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 777c87cf7b34d24df55a66b4d5beed1300d63a1b&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cat 46sshd/module-setup.sh
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cp -R 46sshd /usr/lib/dracut/modules.d/
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then configure SSH for the initrd and rebuild it:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Give the initrd your SSH public keys; dracut-sshd installs this copy as root&amp;#39;s authorized_keys&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -D -m &lt;span class="m">0600&lt;/span> ~/.ssh/authorized_keys /etc/dracut-sshd/authorized_keys
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create a passphrase-less host key for the initrd, so the system&amp;#39;s own host keys stay off the unencrypted /boot&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ssh-keygen -q -t ed25519 -N &lt;span class="s1">&amp;#39;&amp;#39;&lt;/span> -C dell-wyse-initrd -f /etc/ssh/dracut_ssh_host_ed25519_key
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Allow key logins as root: &amp;#39;*&amp;#39; never matches a password, but unlike the locked default it lets keys through&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo usermod -p &lt;span class="s1">&amp;#39;*&amp;#39;&lt;/span> root
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Install the repository&amp;#39;s dracut configuration: host-only image, plus networking and bash&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -D -m &lt;span class="m">0644&lt;/span> etc/dracut.conf.d/90-dell-wyse.conf /etc/dracut.conf.d/90-dell-wyse.conf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Rebuild the initrd of every installed kernel (update-initramfs runs dracut on 26.04)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo update-initramfs -u -k all
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Check the running kernel&amp;#39;s initrd: it must list sshd, authorized_keys and systemd-networkd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo lsinitrd /boot/initrd.img-&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">$(&lt;/span>uname -r&lt;span class="k">)&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="p">|&lt;/span> grep -E &lt;span class="s1">&amp;#39;bin/sshd$|authorized_keys$|systemd-networkd$&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># systemd-networkd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># -rw------- 1 root root 270 Nov 16 12:18 root/.ssh/authorized_keys&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># -rwxr-xr-x 1 root root 1891048 Sep 16 16:55 usr/lib/systemd/systemd-networkd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># -rwxr-xr-x 1 root root 408536 Oct 8 18:36 usr/sbin/sshd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Show the initrd host key&amp;#39;s fingerprint, to compare at the first unlock from the Mac&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ssh-keygen -lf /etc/ssh/dracut_ssh_host_ed25519_key.pub
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 256 SHA256:FWGJEnymGxa1563p16MDF0GPqw5ALgTDDxsAzQbGrZM dell-wyse-initrd (ED25519)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Keep in mind:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>The module&lt;/strong> is outside package management; update it from &lt;code>~/dracut-sshd&lt;/code> when a new release comes out (&lt;a href="#106-updates">section 10.6&lt;/a>).&lt;/li>
&lt;li>&lt;strong>Your keys:&lt;/strong> after changing them, update &lt;code>/etc/dracut-sshd/authorized_keys&lt;/code> and rebuild the initrd.&lt;/li>
&lt;li>&lt;strong>The initrd&amp;rsquo;s host key&lt;/strong> can be read by anyone with the SSD, because &lt;code>/boot&lt;/code> is not encrypted.&lt;/li>
&lt;li>&lt;strong>Root:&lt;/strong> the system&amp;rsquo;s own SSH still refuses root logins, because of the drop-in installed above; only the initrd accepts them.&lt;/li>
&lt;li>&lt;strong>The initrd&amp;rsquo;s network:&lt;/strong> DHCP on every wired interface, with the MAC address as client ID, so the FRITZ!Box reservation gives the initrd &lt;code>192.168.178.55&lt;/code> as well.&lt;/li>
&lt;/ul>
&lt;p>On your &lt;strong>Mac&lt;/strong>, add two host entries to &lt;code>~/.ssh/config&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">Host dell-wyse-lan
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> HostName 192.168.178.55
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> User wmutschl
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> IdentityFile ~/.ssh/id_ed25519
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> IdentitiesOnly yes
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Host dell-wyse-unlock
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> HostName 192.168.178.55
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> User root
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> HostKeyAlias dell-wyse-initrd
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> IdentityFile ~/.ssh/id_ed25519
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> IdentitiesOnly yes
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Only the initrd entry needs &lt;code>HostKeyAlias&lt;/code>: ssh stores and checks the initrd&amp;rsquo;s host key under &lt;code>dell-wyse-initrd&lt;/code>, apart from the system&amp;rsquo;s key, which answers on the same address.
&lt;code>dell-wyse-lan&lt;/code> keeps using the key stored for &lt;code>192.168.178.55&lt;/code> at your first login above.
&lt;code>IdentityFile&lt;/code> names the key you authorized above; adjust it if yours has another name.
&lt;code>IdentitiesOnly&lt;/code> makes ssh offer only that key, not every key in your agent: with many keys loaded, both servers would otherwise give up after six wrong ones with &amp;ldquo;Too many authentication failures&amp;rdquo;.&lt;/p>
&lt;p>Test it by rebooting:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo reboot now
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Wait half a minute, then connect from the &lt;strong>Mac&lt;/strong> and compare the fingerprint with the one printed above:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">ssh dell-wyse-unlock
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># The authenticity of host &amp;#39;dell-wyse-initrd (192.168.178.55)&amp;#39; can&amp;#39;t be established.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ED25519 key fingerprint is: SHA256:FWGJEnymGxa1563p16MDF0GPqw5ALgTDDxsAzQbGrZM&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># This key is not known by any other names.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Are you sure you want to continue connecting (yes/no/[fingerprint])? yes&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Warning: Permanently added &amp;#39;dell-wyse-initrd&amp;#39; (ED25519) to the list of known hosts.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Welcome to the early boot SSH environment. You may type&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># systemd-tty-ask-password-agent&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># (or press &amp;#34;arrow up&amp;#34;) to unlock your disks.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># This shell will terminate automatically a few seconds after the&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># unlocking process has succeeded and when the boot proceeds.&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>In the initrd&amp;rsquo;s shell, answer the prompt:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">systemd-tty-ask-password-agent
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The boot continues and the connection closes.&lt;/p>
&lt;p>Reconnect via SSH as usual and check that the network came up from Netplan, not from the initrd.
The output must name &lt;code>/run/systemd/network/10-netplan-enp1s0.network&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">networkctl status enp1s0 &lt;span class="p">|&lt;/span> grep &lt;span class="s1">&amp;#39;Network File&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Network File: /run/systemd/network/10-netplan-enp1s0.network&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Every reboot from now on&lt;/strong> ends the same way.
From the &lt;strong>Mac&lt;/strong>, the unlock also works in one step:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">ssh -t dell-wyse-unlock systemd-tty-ask-password-agent
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Kernel updates need nothing: dracut&amp;rsquo;s kernel hook builds every new initrd with the same module, keys and settings.
See &lt;a href="https://github.com/gsauthof/dracut-sshd" target="_blank" rel="noopener">dracut-sshd&lt;/a> and &lt;a href="https://www.freedesktop.org/software/systemd/man/latest/systemd-tty-ask-password-agent.html" target="_blank" rel="noopener">systemd-tty-ask-password-agent&lt;/a> for more details.&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
&lt;strong>If the unlock fails.&lt;/strong>
The prompt itself never times out.
After three wrong passphrases, though, &lt;code>systemd-cryptsetup&lt;/code> gives up, and about three minutes later dracut starts its emergency shell on the console.
SSH still works: run &lt;code>systemctl restart 'systemd-cryptsetup@*'&lt;/code>, then &lt;code>systemd-tty-ask-password-agent&lt;/code>, and finally &lt;code>systemctl stop dracut-emergency.service&lt;/code>, which ends the console&amp;rsquo;s emergency shell, so that the boot continues.
Alternatively, run &lt;code>reboot&lt;/code> and unlock again.
&lt;/div>
&lt;/div>
&lt;h2 id="6-install-docker-with-storage-safeguards">6 Install Docker with storage safeguards&lt;/h2>
&lt;p>Docker comes from its own signed repository for Ubuntu.
This section assumes that Docker has never been installed or used on this host.
If &lt;code>docker&lt;/code> is already installed, inspect its workloads and storage before changing anything.
Never remove conflicting packages from an active host without a migration plan.&lt;/p>
&lt;p>Fresh installations of Docker 29 and later use the containerd image store: images and snapshots live in &lt;code>/var/lib/containerd&lt;/code>, named volumes and Docker&amp;rsquo;s configuration in &lt;code>/var/lib/docker&lt;/code>.
Both paths keep their defaults and sit on their own subvolumes (&lt;a href="#4-mount-the-other-subvolumes-before-installing-docker">section 4&lt;/a>); Docker&amp;rsquo;s BTRFS storage driver is not forced.
The default &lt;code>overlayfs&lt;/code> snapshotter works on BTRFS and is the intended setup; the checks after the installation confirm that the host really uses it.
See &lt;a href="https://docs.docker.com/engine/storage/containerd/" target="_blank" rel="noopener">Docker&amp;rsquo;s image store&lt;/a> and the &lt;a href="https://docs.docker.com/engine/storage/drivers/select-storage-driver/" target="_blank" rel="noopener">storage driver guidance&lt;/a> for details.&lt;/p>
&lt;h3 id="61-safeguards-before-dockers-first-start">6.1 Safeguards before Docker&amp;rsquo;s first start&lt;/h3>
&lt;p>Before the package installation starts Docker for the first time, two safeguards must be in place: Docker must refuse to start without its mounts, and container logs must be bounded before the first container exists.
Three files from the repository take care of that:&lt;/p>
&lt;ul>
&lt;li>&lt;code>/etc/systemd/system/docker.service.d/storage.conf&lt;/code>: Docker requires, and asserts, the mounts &lt;code>/home&lt;/code>, &lt;code>/var/lib/docker&lt;/code>, &lt;code>/var/lib/containerd&lt;/code> and &lt;code>/srv/nextcloud&lt;/code>.
&lt;code>/home&lt;/code> is included because the sidecar bind-mounts its configuration from &lt;code>~/scripts/Tailscale&lt;/code>.&lt;/li>
&lt;li>&lt;code>/etc/systemd/system/containerd.service.d/storage.conf&lt;/code>: the same for containerd and &lt;code>/var/lib/containerd&lt;/code>.&lt;/li>
&lt;li>&lt;code>/etc/docker/daemon.json&lt;/code>: &lt;code>&amp;quot;log-driver&amp;quot;: &amp;quot;local&amp;quot;&lt;/code>.&lt;/li>
&lt;/ul>
&lt;p>On &lt;strong>Ubuntu&lt;/strong>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">findmnt -t btrfs -o TARGET,FSROOT,FSTYPE
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># TARGET FSROOT FSTYPE&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># / /@root btrfs&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─/home /@home btrfs&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─/mnt/wyse-top / btrfs&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─/srv/nextcloud /@nextcloud btrfs&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─/srv/ha-backups /@ha-backups btrfs&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─/var/lib/docker /@docker btrfs&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─/var/lib/containerd /@containerd btrfs&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Continue only if every path is mounted from the subvolume shown above&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -d -m &lt;span class="m">0755&lt;/span> /srv/nextcloud/data
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -D -m &lt;span class="m">0644&lt;/span> etc/systemd/system/docker.service.d/storage.conf /etc/systemd/system/docker.service.d/storage.conf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -D -m &lt;span class="m">0644&lt;/span> etc/systemd/system/containerd.service.d/storage.conf /etc/systemd/system/containerd.service.d/storage.conf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -D -m &lt;span class="m">0644&lt;/span> etc/docker/daemon.json /etc/docker/daemon.json
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl daemon-reload
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The two drop-ins stop Docker from silently starting its restart-policy containers against empty directories on the root filesystem when the dedicated mounts are missing.&lt;/p>
&lt;h3 id="62-installation">6.2 Installation&lt;/h3>
&lt;p>Add Docker&amp;rsquo;s package repository and its signing key:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo install -m &lt;span class="m">0755&lt;/span> -d /etc/apt/keyrings
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -o /etc/apt/keyrings/docker.asc
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo chmod a+r /etc/apt/keyrings/docker.asc
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo tee /etc/apt/sources.list.d/docker.sources &amp;gt;/dev/null &lt;span class="s">&amp;lt;&amp;lt;EOF
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Types: deb
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">URIs: https://download.docker.com/linux/ubuntu
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Suites: $(. /etc/os-release &amp;amp;&amp;amp; echo &amp;#34;${UBUNTU_CODENAME:-$VERSION_CODENAME}&amp;#34;)
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Components: stable
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Architectures: $(dpkg --print-architecture)
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Signed-By: /etc/apt/keyrings/docker.asc
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then install the engine, its command-line client, containerd and the Compose plugin.
The installation starts Docker right away, which is why the safeguards above had to come first:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo apt update
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt install --no-install-recommends -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl &lt;span class="nb">enable&lt;/span> --now containerd.service docker.service
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Check the result:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Docker Engine 29 and the Compose plugin&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker version --format &lt;span class="s1">&amp;#39;{{.Server.Version}}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 29.9.3&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker compose version --short
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 5.7.1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Storage: overlayfs through the containerd image store&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker info --format &lt;span class="s1">&amp;#39;{{.Driver}} {{json .DriverStatus}}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># overlayfs [[&amp;#34;driver-type&amp;#34;,&amp;#34;io.containerd.snapshotter.v1&amp;#34;]]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Logging: the repository&amp;#39;s daemon.json is valid and in use&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo dockerd --validate --config-file&lt;span class="o">=&lt;/span>/etc/docker/daemon.json
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># configuration OK&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker info --format &lt;span class="s1">&amp;#39;{{.LoggingDriver}}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># local&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># A first container&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker run --rm hello-world
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If a check fails, investigate before you deploy Nextcloud AIO.
Do not change the storage backend later: images and containers created with one backend are invisible to the other.
The &lt;code>local&lt;/code> log driver rotates its logs by default; containers that set their own log options keep them.
See the &lt;a href="https://docs.docker.com/engine/install/ubuntu/" target="_blank" rel="noopener">Docker installation guide&lt;/a> and &lt;a href="https://docs.docker.com/engine/logging/configure/" target="_blank" rel="noopener">Docker logging&lt;/a> for details.&lt;/p>
&lt;p>Access to Docker is effectively root access to the host: whoever can talk to the Docker socket can start a container that mounts &lt;code>/&lt;/code> and change anything there.
Docker&amp;rsquo;s post-installation guide offers the &lt;code>docker&lt;/code> group for convenience, but warns that the group grants root-level privileges.
For your account, that would mean root without a password prompt and without an entry in the sudo log, for you and for anything that runs as you.
So keep using &lt;code>sudo docker&lt;/code>, as every command in this guide does, and never expose the Docker API over TCP.
Keep Docker&amp;rsquo;s firewall integration enabled.
Do not apply global privilege-removal or &lt;code>userns-remap&lt;/code> templates to this Nextcloud AIO setup: the mastercontainer needs the Docker API, and Docker 29 does not support the containerd image store with &lt;code>userns-remap&lt;/code>.
The daemon would fall back to the classic storage driver and hide all existing images and containers.
See &lt;a href="https://docs.docker.com/engine/security/" target="_blank" rel="noopener">Docker security&lt;/a>, &lt;a href="https://docs.docker.com/engine/install/linux-postinstall/" target="_blank" rel="noopener">Docker&amp;rsquo;s post-installation steps&lt;/a> and the &lt;a href="https://github.com/nextcloud/all-in-one/blob/main/compose.yaml" target="_blank" rel="noopener">Nextcloud AIO deployment definition&lt;/a> for details.&lt;/p>
&lt;h2 id="7-backup-disks-snapshots-alerts-and-the-home-assistant-share">7 Backup disks, snapshots, alerts and the Home Assistant share&lt;/h2>
&lt;p>Set this up before either Nextcloud path, so that the first data already lands on snapshotted, backed-up and monitored storage.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Job&lt;/th>
&lt;th>When&lt;/th>
&lt;th>From → to&lt;/th>
&lt;th>Reports to healthchecks.io as&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>BTRBK snapshot&lt;/td>
&lt;td>Hourly&lt;/td>
&lt;td>Live subvolumes → &lt;code>@snapshots&lt;/code> on the Vi560&lt;/td>
&lt;td>&lt;code>dell-wyse-btrbk-snapshot&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>BTRBK send/receive&lt;/td>
&lt;td>Daily, 01:30&lt;/td>
&lt;td>&lt;code>@snapshots&lt;/code> → HDD 1, &lt;code>/mnt/btrbk/wyse&lt;/code>&lt;/td>
&lt;td>&lt;code>dell-wyse-btrbk-send&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>AIO Borg backup&lt;/td>
&lt;td>Daily, 03:00 UTC, i.e. 04:00 CET or 05:00 CEST (set in AIO, &lt;a href="#101-aio-borg-backup-to-hdd-2">section 10.1&lt;/a>)&lt;/td>
&lt;td>Nextcloud → HDD 2, &lt;code>/mnt/backup/borg&lt;/code>&lt;/td>
&lt;td>AIO notifies its administrators; the off-site job notices a backup that never ran&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Home Assistant backup&lt;/td>
&lt;td>Daily, at HA&amp;rsquo;s &amp;ldquo;System optimal&amp;rdquo; time&lt;/td>
&lt;td>Pi → &lt;code>/srv/ha-backups&lt;/code>, then to HDD 1 with the next daily send&lt;/td>
&lt;td>&lt;code>dell-wyse-ha-backup-check&lt;/code>, daily at 07:00&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Off-site mirror&lt;/td>
&lt;td>Daily, 06:30, once AIO&amp;rsquo;s backup has finished&lt;/td>
&lt;td>Borg repository and &lt;code>/srv/ha-backups&lt;/code> → Storage Box&lt;/td>
&lt;td>&lt;code>dell-wyse-offsite&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>BTRFS scrub&lt;/td>
&lt;td>Monthly, on the 1st at 10:00&lt;/td>
&lt;td>Vi560 and both HDDs&lt;/td>
&lt;td>&lt;code>dell-wyse-scrub&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>SMART monitoring&lt;/td>
&lt;td>Continuously; self-tests weekly and monthly&lt;/td>
&lt;td>Vi560 and both HDDs&lt;/td>
&lt;td>&lt;code>dell-wyse-smartd&lt;/code>, failures only&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Uptime&lt;/td>
&lt;td>Every five minutes&lt;/td>
&lt;td>–&lt;/td>
&lt;td>&lt;code>dell-wyse-alive&lt;/code>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The layers do different jobs:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Snapshots&lt;/strong> are atomic per subvolume, like the state after a power cut.
They are the quickest way to get back a deleted folder, a previous HA backup, or the host before a bad change.
PostgreSQL in &lt;code>@docker&lt;/code> recovers from such a crash-consistent state.
&lt;code>@docker&lt;/code> and &lt;code>@nextcloud&lt;/code> are snapshotted a moment apart, though, so database and files from snapshots can disagree slightly.&lt;/li>
&lt;li>&lt;strong>Borg&lt;/strong>, through AIO, stops the containers while it backs up.
It is the consistent copy to restore the Nextcloud application from (Path B).&lt;/li>
&lt;li>&lt;strong>The off-site mirror&lt;/strong> is a copy of the already encrypted Borg repository and HA backups outside the house, for the day the house loses all three disks.
The Storage Box&amp;rsquo;s own snapshots protect it against a sync that copies damage or deletions.&lt;/li>
&lt;li>&lt;strong>Not snapshotted:&lt;/strong> &lt;code>@containerd&lt;/code>, because images are downloaded again, and &lt;code>@snapshots&lt;/code> itself.&lt;/li>
&lt;/ul>
&lt;p>Install the packages, then put the backup configuration, the &lt;code>dell-wyse-*&lt;/code> units and their scripts in place:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Install BTRBK, Samba, cryptsetup, and parted for partitioning the HDDs in section 7.2&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt install --no-install-recommends btrbk samba cryptsetup parted -y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Disable BTRBK&amp;#39;s own timer, if the package ships one; the dell-wyse-* timers replace it&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl list-unit-files &lt;span class="s1">&amp;#39;btrbk*&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UNIT FILE STATE PRESET &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># btrbk.service static - &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># btrbk.timer enabled enabled&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 2 unit files listed.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl disable --now btrbk.timer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Removed &amp;#39;/etc/systemd/system/timers.target.wants/btrbk.timer&amp;#39;.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Copy the configuration, units and scripts from the repository&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -D -m &lt;span class="m">0644&lt;/span> etc/btrbk/btrbk.conf /etc/btrbk/btrbk.conf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -D -m &lt;span class="m">0644&lt;/span> etc/samba/smb.conf /etc/samba/smb.conf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -D -m &lt;span class="m">0644&lt;/span> etc/smartd.conf /etc/smartd.conf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -m &lt;span class="m">0644&lt;/span> etc/systemd/system/dell-wyse-* /etc/systemd/system/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -m &lt;span class="m">0755&lt;/span> usr/local/sbin/dell-wyse-* /usr/local/sbin/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl daemon-reload
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create the settings file from its template, but never overwrite an existing one&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">[&lt;/span> -e /etc/dell-wyse/host.env &lt;span class="o">]&lt;/span> &lt;span class="o">||&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> sudo install -D -m &lt;span class="m">0600&lt;/span> host.env.example /etc/dell-wyse/host.env
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Restart Samba with the new configuration, so the package&amp;#39;s default shares disappear right away&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl restart smbd
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Installed on the Wyse&lt;/th>
&lt;th>Purpose&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>/usr/local/sbin/dell-wyse-hc-ping&lt;/code>, &lt;code>dell-wyse-fail@.service&lt;/code>&lt;/td>
&lt;td>Success and failure pings to healthchecks.io (&lt;a href="#71-alerts-to-healthchecksio">7.1&lt;/a>)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>dell-wyse-alive.timer&lt;/code>&lt;/td>
&lt;td>Uptime ping (&lt;a href="#71-alerts-to-healthchecksio">7.1&lt;/a>)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/etc/btrbk/btrbk.conf&lt;/code>, &lt;code>dell-wyse-btrbk-snapshot.timer&lt;/code>, &lt;code>dell-wyse-btrbk-send.timer&lt;/code>&lt;/td>
&lt;td>Snapshots and send/receive (&lt;a href="#73-hourly-snapshots-and-daily-sendreceive-with-btrbk">7.3&lt;/a>)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>dell-wyse-scrub.timer&lt;/code>, &lt;code>/etc/smartd.conf&lt;/code>, &lt;code>/usr/local/sbin/dell-wyse-smartd-alert&lt;/code>&lt;/td>
&lt;td>Disk health (&lt;a href="#74-disk-health-monthly-scrub-and-smart-monitoring">7.4&lt;/a>)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/etc/samba/smb.conf&lt;/code>, &lt;code>dell-wyse-ha-backup-check.timer&lt;/code> and its script&lt;/td>
&lt;td>Home Assistant share and its daily check (&lt;a href="#75-backup-share-for-home-assistant">7.5&lt;/a>)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>dell-wyse-offsite.timer&lt;/code>, &lt;code>/usr/local/sbin/dell-wyse-offsite&lt;/code>&lt;/td>
&lt;td>Off-site mirror on the Storage Box (&lt;a href="#76-off-site-mirror-on-a-hetzner-storage-box">7.6&lt;/a>)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/etc/dell-wyse/host.env&lt;/code>&lt;/td>
&lt;td>Secrets and settings, created once from the template with mode 600, never overwritten&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The units live in &lt;code>/etc/systemd/system&lt;/code>, and every job follows the same pattern.
On success, it pings its own check, named like the unit.
On failure, &lt;code>dell-wyse-fail@&lt;/code> sends a failure ping that carries the unit&amp;rsquo;s last 40 log lines.
A run that never happens, because the Wyse is off, a disk is missing or a timer stopped, shows up when the expected ping does not arrive.&lt;/p>
&lt;h3 id="71-alerts-to-healthchecksio">7.1 Alerts to healthchecks.io&lt;/h3>
&lt;ol>
&lt;li>
&lt;p>In healthchecks.io, open the project for your machines and create a &lt;strong>ping key&lt;/strong> in its &lt;strong>Settings&lt;/strong>.
With it, every check has a URL of the form &lt;code>https://hc-ping.com/&amp;lt;ping key&amp;gt;/&amp;lt;check name&amp;gt;&lt;/code>, and &lt;code>?create=1&lt;/code>, which the script adds, creates each check on its first ping.
One key serves all jobs.
Add integrations for the notifications, such as email and Signal.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Enter the key as &lt;code>HC_PING_KEY&lt;/code> in the host&amp;rsquo;s settings file.
The off-site values follow in &lt;a href="#76-off-site-mirror-on-a-hetzner-storage-box">section 7.6&lt;/a>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudoedit /etc/dell-wyse/host.env
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>Test both directions on the uptime check itself, so that no test check is left to delete.
The first command creates the check &lt;code>dell-wyse-alive&lt;/code> and sets it to down; check that the alert reached you through your usual integration.
The other two start the uptime ping.
Its timer first fires at the next full five minutes, so the last command sends a ping through the unit right away.
That sets the check back to up and tests the same path that the timer takes:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo dell-wyse-hc-ping alive fail &lt;span class="s1">&amp;#39;Test alert from the Wyse&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl &lt;span class="nb">enable&lt;/span> --now dell-wyse-alive.timer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl start dell-wyse-alive.service
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>Each job creates its check on its first run, with healthchecks.io&amp;rsquo;s defaults of a 1-day period and a 1-hour grace time.
Once the checks appear, set their period and grace time:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Check&lt;/th>
&lt;th>Period&lt;/th>
&lt;th>Grace&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>dell-wyse-alive&lt;/code>&lt;/td>
&lt;td>5 minutes&lt;/td>
&lt;td>1 minute&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>dell-wyse-btrbk-send&lt;/code>&lt;/td>
&lt;td>1 day&lt;/td>
&lt;td>6 hours&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>dell-wyse-btrbk-snapshot&lt;/code>&lt;/td>
&lt;td>1 hour&lt;/td>
&lt;td>1 hour&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>dell-wyse-ha-backup-check&lt;/code>&lt;/td>
&lt;td>1 day&lt;/td>
&lt;td>2 hours&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>dell-wyse-offsite&lt;/code>&lt;/td>
&lt;td>1 day&lt;/td>
&lt;td>6 hours&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>dell-wyse-scrub&lt;/code>&lt;/td>
&lt;td>31 days&lt;/td>
&lt;td>2 days&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>dell-wyse-smartd&lt;/code>&lt;/td>
&lt;td>365 days&lt;/td>
&lt;td>Any; it only receives failures&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The longest run, a send after an import, can overrun its grace time once; that alert is expected.
The first off-site upload takes days, but its check appears only when that run ends (&lt;a href="#76-off-site-mirror-on-a-hetzner-storage-box">section 7.6&lt;/a>, step 6).&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>Failure pings carry log lines to healthchecks.io: unit names, paths and error messages, nothing from the files themselves.
Nothing else from these jobs leaves the host.
Nextcloud AIO reports its own backup failures as a Nextcloud notification to the administrators, so make sure those reach you, for example through the administrator&amp;rsquo;s email address.&lt;/p>
&lt;h3 id="72-prepare-the-two-hdds">7.2 Prepare the two HDDs&lt;/h3>
&lt;p>Attach both HDDs, ideally on their own power supplies.
Identify each by model, serial and size.&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Put the two HDDs on different USB hubs.&lt;/strong>
The Wyse&amp;rsquo;s blue USB 3 ports do not each have their own line to the USB controller.
The four rear ports share one internal 4-port hub, and the front blue port sits on a separate 2-port hub.
The two front black ports are USB 2 only and too slow for a disk; leave them for a keyboard receiver or an installer stick.
Connect HDD 1 to a rear port and HDD 2 to the front blue port.
Then a reset or power dip on one hub no longer takes out both backup disks at once, and the spin-up current of two bus-powered drives is spread over two hubs.
Speed hardly changes, because the jobs that use the two disks rarely run at the same time.
HDD 2 goes in front because an interrupted Borg backup recovers on its own, so a bumped cable costs less there; HDD 1 stays at the back, out of the way.
No configuration depends on the port, so you can move a disk later: unmount it first, for example with &lt;code>sudo systemctl stop mnt-backup.mount&lt;/code>, then mount it again and restart &lt;code>smartd&lt;/code>.
To see which hub each disk is on:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">lsusb -t
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">for&lt;/span> d in /sys/block/sd?&lt;span class="p">;&lt;/span> &lt;span class="k">do&lt;/span> readlink -f &lt;span class="nv">$d&lt;/span> &lt;span class="p">|&lt;/span> tr / &lt;span class="s1">&amp;#39;\n&amp;#39;&lt;/span> &lt;span class="p">|&lt;/span> grep -E &lt;span class="s1">&amp;#39;^[0-9]+-[0-9.]+$&amp;#39;&lt;/span> &lt;span class="p">|&lt;/span> tail -1 &lt;span class="p">|&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> sed &lt;span class="s2">&amp;#34;s/^/&lt;/span>&lt;span class="k">$(&lt;/span>basename &lt;span class="nv">$d&lt;/span>&lt;span class="k">)&lt;/span>&lt;span class="s2"> &lt;/span>&lt;span class="k">$(&lt;/span>cat &lt;span class="nv">$d&lt;/span>/device/model&lt;span class="k">)&lt;/span>&lt;span class="s2"> -&amp;gt; /&amp;#34;&lt;/span>&lt;span class="p">;&lt;/span> &lt;span class="k">done&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdb Elements 2621 -&amp;gt; 2-1.1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdc External USB 3.0 -&amp;gt; 2-6.2&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>2-1.x&lt;/code> is the rear hub and &lt;code>2-6.x&lt;/code> the front one; both should show 5000M in &lt;code>lsusb -t&lt;/code>.
Seen from the back of the Wyse, the rear ports map like this:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Rear port&lt;/th>
&lt;th>Address&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Top left&lt;/td>
&lt;td>&lt;code>2-1.1&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Top right&lt;/td>
&lt;td>&lt;code>2-1.2&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Bottom left&lt;/td>
&lt;td>&lt;code>2-1.3&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Bottom right&lt;/td>
&lt;td>&lt;code>2-1.4&lt;/code>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The front ports, from top to bottom:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Front port&lt;/th>
&lt;th>Address&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>USB-C&lt;/td>
&lt;td>&lt;code>2-2&lt;/code> (USB 3, directly on the controller, no hub)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Blue USB-A&lt;/td>
&lt;td>&lt;code>2-6.2&lt;/code> (USB 3)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Upper black USB-A&lt;/td>
&lt;td>&lt;code>1-3&lt;/code> (USB 2 only)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Lower black USB-A&lt;/td>
&lt;td>&lt;code>1-4&lt;/code> (USB 2 only)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>A USB 3 device in a black port runs at 480M, under bus 1 in &lt;code>lsusb -t&lt;/code>.
The USB-C port would also work for a disk, through a USB-C cable or adapter, and shares nothing with the other ports.
A disk at the back is still less likely to be knocked loose than one hanging off an adapter in front, so the layout above stays my recommendation.&lt;/p>
&lt;/div>
&lt;/div>
&lt;ul>
&lt;li>HDD 1 receives plain copies of every snapshotted subvolume, including all user files and &lt;code>~/scripts/Dell-Wyse-Thin-Client-5070/.env&lt;/code> with the OAuth secret, so it gets LUKS2 encryption.
A random keyfile on the encrypted SSD unlocks it at boot without a prompt.
HDD 1 is therefore exactly as safe as the SSD: lost, stolen, returned under warranty or thrown away, on its own or together with the SSD, it exposes nothing.
The keyfile lives inside the encrypted SSD, so reaching it takes the SSD&amp;rsquo;s passphrase.
&lt;code>luksFormat&lt;/code> also asks for a passphrase of HDD 1&amp;rsquo;s own.
Generate a long one in your password manager and keep it there: it is the only way into HDD 1 once the SSD, and the keyfile with it, is gone, which is exactly when you need HDD 1.&lt;/li>
&lt;li>HDD 2 needs no LUKS, because Borg encrypts the repository itself.&lt;/li>
&lt;/ul>
&lt;p>The J4105 has AES-NI, so the encryption costs nothing noticeable at USB HDD speeds (&lt;code>cryptsetup benchmark&lt;/code> shows the numbers).&lt;/p>
&lt;p>Which subsection comes next depends on what is on the HDDs:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>New HDDs, or disks with nothing you still need:&lt;/strong> &lt;a href="#721-new-hdds-partition-and-encrypt">section 7.2.1&lt;/a> erases, partitions and encrypts them.&lt;/li>
&lt;li>&lt;strong>HDDs that already hold this guide&amp;rsquo;s backups&lt;/strong>, for example when you rebuild the Wyse after replacing the SSD or reinstalling Ubuntu, or move the disks to another Wyse: skip section 7.2.1, which would erase them, and follow &lt;a href="#722-rebuilding-the-wyse-reuse-the-hdds">section 7.2.2&lt;/a> instead.&lt;/li>
&lt;li>&lt;strong>One new HDD next to one that still holds backups&lt;/strong>, for example a replacement for a failed HDD 2: in section 7.2.1, set the new disk&amp;rsquo;s variable in the first block and run only that disk&amp;rsquo;s block; leave the other disk as it is, or reuse it as in section 7.2.2 when you rebuild the Wyse.
On a Wyse that is already set up, the note &lt;strong>Replacing a single HDD&lt;/strong> at the start of &lt;a href="#723-unlock-and-mount-the-hdds-at-boot">section 7.2.3&lt;/a> says what to do next.&lt;/li>
&lt;/ul>
&lt;p>Both paths continue with &lt;a href="#723-unlock-and-mount-the-hdds-at-boot">section 7.2.3&lt;/a>, in the same terminal session, because its commands rely on the &lt;code>HDD1&lt;/code> shell variable.&lt;/p>
&lt;h4 id="721-new-hdds-partition-and-encrypt">7.2.1 New HDDs: partition and encrypt&lt;/h4>
&lt;div class="alert alert-warning">
&lt;div>
&lt;strong>This subsection erases the HDDs you run it on.&lt;/strong>
Run it only on disks that hold nothing you still need.
Disks with this guide&amp;rsquo;s backups, labelled &lt;code>wyse-btrbk-luks&lt;/code> and &lt;code>wyse-borg&lt;/code>, belong in &lt;a href="#722-rebuilding-the-wyse-reuse-the-hdds">section 7.2.2&lt;/a>, whichever Wyse they come from.
&lt;/div>
&lt;/div>
&lt;p>The &lt;code>parted&lt;/code>, &lt;code>wipefs&lt;/code>, &lt;code>luksFormat&lt;/code> and &lt;code>mkfs&lt;/code> lines &lt;strong>erase&lt;/strong> the named disk, so check the paths twice.
Each disk has its own block, so that you can also prepare a single new disk without touching the other one; in that case, set and use only the new disk&amp;rsquo;s variable.
Each block starts with a check that prints the disk&amp;rsquo;s labels if it already holds any of this guide&amp;rsquo;s backups: if it prints anything, stop.
Enter the commands one by one in the same terminal session, because they rely on the &lt;code>HDD1&lt;/code> and &lt;code>HDD2&lt;/code> shell variables:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># List the disks and their by-id paths; identify both HDDs by model, serial and size&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -o NAME,SIZE,MODEL,SERIAL,FSTYPE,MOUNTPOINTS
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdb 5.5T WDC WD60NDZW-11C8XS0 WD-WX62D343TDXJ &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─sdb1 200M vfat &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─sdb2 5.5T apfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdc 3.6T TOSHIBA MQ04UBB400 X0S7T0TWT &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─sdc1 200M vfat &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─sdc2 3.6T apfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls -l /dev/disk/by-id/usb-*
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 9 Nov 16 13:29 /dev/disk/by-id/usb-TOSHIBA_External_USB_3.0_20201028020375F-0:0 -&amp;gt; ../../sdc&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 10 Nov 16 13:29 /dev/disk/by-id/usb-TOSHIBA_External_USB_3.0_20201028020375F-0:0-part1 -&amp;gt; ../../sdc1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 10 Nov 16 13:29 /dev/disk/by-id/usb-TOSHIBA_External_USB_3.0_20201028020375F-0:0-part2 -&amp;gt; ../../sdc2&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 9 Nov 16 13:29 /dev/disk/by-id/usb-WD_Elements_2621_57583632443334335444584A-0:0 -&amp;gt; ../../sdb&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 10 Nov 16 13:29 /dev/disk/by-id/usb-WD_Elements_2621_57583632443334335444584A-0:0-part1 -&amp;gt; ../../sdb1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># lrwxrwxrwx 1 root root 10 Nov 16 13:29 /dev/disk/by-id/usb-WD_Elements_2621_57583632443334335444584A-0:0-part2 -&amp;gt; ../../sdb2&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Set the whole-disk paths of both HDDs (no -partN suffix; use the TAB key to complete the path)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">HDD1&lt;/span>&lt;span class="o">=&lt;/span>/dev/disk/by-id/usb-WD_Elements_2621_57583632443334335444584A-0:0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">HDD2&lt;/span>&lt;span class="o">=&lt;/span>/dev/disk/by-id/usb-TOSHIBA_External_USB_3.0_20201028020375F-0:0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Confirm the choice: both disks with the expected model, serial and size, and nothing mounted&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -o NAME,MODEL,SERIAL,SIZE,FSTYPE,MOUNTPOINTS &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD2&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME MODEL SERIAL SIZE FSTYPE MOUNTPOINTS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdb WDC WD60NDZW-11C8XS0 WD-WX62D343TDXJ 5.5T &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─sdb1 200M vfat &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─sdb2 5.5T apfs &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdc TOSHIBA MQ04UBB400 X0S7T0TWT 3.6T &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ├─sdc1 200M vfat &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─sdc2 3.6T apfs &lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>HDD 1.&lt;/strong> Skip this block when you replace only HDD 2:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Stop if this prints anything: the disk then holds this guide&amp;#39;s backups (section 7.2.2)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -no LABEL &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="si">${&lt;/span>&lt;span class="nv">HDD1&lt;/span>&lt;span class="p">:?is not set&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="p">|&lt;/span> grep -xE &lt;span class="s1">&amp;#39;wyse-btrbk-luks|wyse-btrbk|wyse-borg&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Erase HDD 1, give it one GPT partition and remove leftover signatures, such as a factory NTFS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo parted -s &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> mklabel gpt mkpart btrbk 1MiB 100%
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo udevadm settle
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo wipefs -a &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create HDD 1&amp;#39;s random keyfile on the encrypted SSD, readable by root only&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -d -m &lt;span class="m">0700&lt;/span> /etc/cryptsetup-keys.d
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo sh -c &lt;span class="s1">&amp;#39;umask 077; head -c 64 /dev/urandom &amp;gt; /etc/cryptsetup-keys.d/wyse-btrbk.key&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Encrypt HDD 1: luksFormat asks for YES and the new passphrase twice, luksAddKey for that passphrase once more&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cryptsetup luksFormat --type luks2 --label wyse-btrbk-luks &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cryptsetup luksAddKey &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1 /etc/cryptsetup-keys.d/wyse-btrbk.key
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Open HDD 1 with the keyfile, create its BTRFS filesystem and close it again&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cryptsetup open --key-file /etc/cryptsetup-keys.d/wyse-btrbk.key &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1 wyse-btrbk
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mkfs.btrfs -L wyse-btrbk /dev/mapper/wyse-btrbk
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Label: wyse-btrbk&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UUID: 4b86cac9-cb64-4b82-aae3-05808b66c6ec&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Node size: 16384&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Sector size: 4096 (CPU page size: 4096)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Filesystem size: 5.46TiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Block group profiles:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Data: single 8.00MiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Metadata: DUP 1.00GiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># System: DUP 8.00MiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># SSD detected: no&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Zoned device: no&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Features: extref, skinny-metadata, no-holes, free-space-tree&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Checksum: crc32c&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Number of devices: 1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Devices:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ID SIZE PATH &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 1 5.46TiB /dev/mapper/wyse-btrbk&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cryptsetup close wyse-btrbk
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>HDD 2.&lt;/strong> Skip this block when you replace only HDD 1:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Stop if this prints anything: the disk then holds this guide&amp;#39;s backups (section 7.2.2)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -no LABEL &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="si">${&lt;/span>&lt;span class="nv">HDD2&lt;/span>&lt;span class="p">:?is not set&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="p">|&lt;/span> grep -xE &lt;span class="s1">&amp;#39;wyse-btrbk-luks|wyse-btrbk|wyse-borg&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Erase HDD 2, give it one GPT partition and remove leftover signatures, such as a factory NTFS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo parted -s &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD2&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> mklabel gpt mkpart borg btrfs 1MiB 100%
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo udevadm settle
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo wipefs -a &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD2&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create HDD 2&amp;#39;s BTRFS filesystem, without LUKS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mkfs.btrfs -L wyse-borg &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD2&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Label: wyse-borg&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># UUID: 63bbf56c-2f0e-48f8-a527-7bd66b4c3aa0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Node size: 16384&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Sector size: 4096 (CPU page size: 4096)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Filesystem size: 3.64TiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Block group profiles:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Data: single 8.00MiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Metadata: DUP 1.00GiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># System: DUP 8.00MiB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># SSD detected: no&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Zoned device: no&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Features: extref, skinny-metadata, no-holes, free-space-tree&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Checksum: crc32c&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Number of devices: 1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Devices:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ID SIZE PATH &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 1 3.64TiB /dev/disk/by-id/usb-TOSHIBA_External_USB_3.0_20201028020375F-0:0-part1&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Check the result:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Verify: partition btrbk holds crypto_LUKS (wyse-btrbk-luks), partition borg holds btrfs (wyse-borg)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -o NAME,SIZE,PARTLABEL,FSTYPE,LABEL &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD2&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME SIZE PARTLABEL FSTYPE LABEL&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdb 5.5T &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─sdb1 5.5T btrbk crypto_LUKS wyse-btrbk-luks&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdc 3.6T &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─sdc1 3.6T borg btrfs wyse-borg&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Optional: back up HDD 1&amp;rsquo;s LUKS header to your password manager.&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo cryptsetup luksHeaderBackup &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1 --header-backup-file ~/wyse-btrbk-luks-header.img
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo chown &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$USER&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> ~/wyse-btrbk-luks-header.img
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Store the header backup in your password manager next to HDD 1&amp;rsquo;s passphrase, as for the SSD&amp;rsquo;s header in &lt;a href="#34-first-encrypted-boot">section 3.4&lt;/a>, then delete it from the Wyse.
If the LUKS header on the disk is ever damaged, that file and the passphrase are the only way back in.&lt;/p>
&lt;/div>
&lt;/div>
&lt;p>Both disks get BTRFS for checksums and scrub; HDD 1 needs it anyway to receive snapshots.
Continue with &lt;a href="#723-unlock-and-mount-the-hdds-at-boot">section 7.2.3&lt;/a>; when you replace a single HDD on a Wyse that is already set up, follow only its first note.&lt;/p>
&lt;h4 id="722-rebuilding-the-wyse-reuse-the-hdds">7.2.2 Rebuilding the Wyse: reuse the HDDs&lt;/h4>
&lt;p>When you rebuild the Wyse, both HDDs keep their contents, and they hold your backups.
So this subsection only identifies them and gets back HDD 1&amp;rsquo;s keyfile; nothing here erases or formats a disk.
Enter the commands one by one in the same terminal session that you then use for &lt;a href="#723-unlock-and-mount-the-hdds-at-boot">section 7.2.3&lt;/a>, because they rely on the &lt;code>HDD1&lt;/code> and &lt;code>HDD2&lt;/code> shell variables:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># List the disks and their by-id paths; identify both HDDs by model, serial and size&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -o NAME,SIZE,MODEL,SERIAL,FSTYPE,LABEL,MOUNTPOINTS
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls -l /dev/disk/by-id/usb-*
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Set the whole-disk paths of both HDDs (no -partN suffix; use the TAB key to complete the path)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">HDD1&lt;/span>&lt;span class="o">=&lt;/span>/dev/disk/by-id/usb-WD_Elements_2621_57583632443334335444584A-0:0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">HDD2&lt;/span>&lt;span class="o">=&lt;/span>/dev/disk/by-id/usb-TOSHIBA_External_USB_3.0_20201028020375F-0:0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Confirm: partition btrbk holds crypto_LUKS (wyse-btrbk-luks), partition borg holds btrfs (wyse-borg)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">lsblk -o NAME,SIZE,PARTLABEL,FSTYPE,LABEL &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD2&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NAME SIZE PARTLABEL FSTYPE LABEL&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdb 5.5T &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─sdb1 5.5T btrbk crypto_LUKS wyse-btrbk-luks&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># sdc 3.6T &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># └─sdc1 3.6T borg btrfs wyse-borg&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>HDD 1&amp;rsquo;s keyfile went with the old SSD, but a copy sits inside HDD 1&amp;rsquo;s newest &lt;code>@root&lt;/code> backup.
Unlock HDD 1 once with its passphrase from your password manager and take the keyfile from there:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo cryptsetup open &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1 wyse-btrbk
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">tmp&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>mktemp -d&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mount -o ro /dev/mapper/wyse-btrbk &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$tmp&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">latest&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>sudo sh -c &lt;span class="s2">&amp;#34;ls -d &amp;#39;&lt;/span>&lt;span class="nv">$tmp&lt;/span>&lt;span class="s2">&amp;#39;/wyse/@root.* | tail -n 1&amp;#34;&lt;/span>&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -d -m &lt;span class="m">0700&lt;/span> /etc/cryptsetup-keys.d
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -m &lt;span class="m">0400&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$latest&lt;/span>&lt;span class="s2">/etc/cryptsetup-keys.d/wyse-btrbk.key&amp;#34;&lt;/span> /etc/cryptsetup-keys.d/wyse-btrbk.key
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo umount &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$tmp&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rmdir &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$tmp&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cryptsetup close wyse-btrbk
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The new SSD&amp;rsquo;s subvolumes are new to BTRBK, so its first send to HDD 1 is a full copy again.
It sits next to the old backups until the retention removes them, which takes up to twelve months; delete the oldest old backups by hand if HDD 1 runs short of space.&lt;/p>
&lt;h4 id="723-unlock-and-mount-the-hdds-at-boot">7.2.3 Unlock and mount the HDDs at boot&lt;/h4>
&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Replacing a single HDD on a Wyse that is already set up?&lt;/strong>
Then skip the block below: its &lt;code>crypttab&lt;/code> and &lt;code>fstab&lt;/code> lines already exist.
After preparing the new disk with its block in &lt;a href="#721-new-hdds-partition-and-encrypt">section 7.2.1&lt;/a>, do only this:&lt;/p>
&lt;p>&lt;strong>New HDD 2:&lt;/strong> its &lt;code>fstab&lt;/code> line finds it by its label &lt;code>wyse-borg&lt;/code>, so mount it with &lt;code>sudo systemctl start mnt-backup.mount&lt;/code>.
HDD 2&amp;rsquo;s line in the repository&amp;rsquo;s &lt;code>smartd.conf&lt;/code> names the old disk by its by-id path, which contains its serial number: change it to the new disk&amp;rsquo;s path, or remove it if the new USB bridge reports standby (&lt;a href="#74-disk-health-monthly-scrub-and-smart-monitoring">section 7.4&lt;/a>), and copy the file again.
Then copy the Borg repository back from the Storage Box (&lt;a href="#77-restore-from-the-storage-box">section 7.7&lt;/a>).&lt;/p>
&lt;p>&lt;strong>New HDD 1:&lt;/strong> point the existing &lt;code>wyse-btrbk&lt;/code> line in &lt;code>/etc/crypttab&lt;/code> at the new disk&amp;rsquo;s LUKS UUID, then mount it.
The next daily send copies everything again in full.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="nv">luks_uuid&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>sudo cryptsetup luksUUID &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">[&lt;/span> -n &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$luks_uuid&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="o">]&lt;/span> &lt;span class="o">&amp;amp;&amp;amp;&lt;/span> sudo sed -i -E &lt;span class="s2">&amp;#34;s|^(wyse-btrbk[[:space:]]+)UUID=[^[:space:]]+|\1UUID=&lt;/span>&lt;span class="nv">$luks_uuid&lt;/span>&lt;span class="s2">|&amp;#34;&lt;/span> /etc/crypttab
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">grep &lt;span class="s1">&amp;#39;^wyse-btrbk &amp;#39;&lt;/span> /etc/crypttab
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl daemon-reload
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl start mnt-btrbk.mount
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -d -m &lt;span class="m">0700&lt;/span> /mnt/btrbk/wyse
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Either disk:&lt;/strong> &lt;code>smartd&lt;/code> scans for disks only when it starts, so finish with &lt;code>sudo systemctl restart smartmontools.service&lt;/code> and check its journal as in &lt;a href="#74-disk-health-monthly-scrub-and-smart-monitoring">section 7.4&lt;/a>.&lt;/p>
&lt;/div>
&lt;/div>
&lt;p>Now let systemd unlock and mount both HDDs.
HDD 2 is mounted without compression, because Borg data is already compressed and encrypted.
The &lt;code>crypttab&lt;/code> line unlocks HDD 1 with the keyfile whenever the disk is present, and &lt;code>nofail&lt;/code> lets Ubuntu boot without either disk.
&lt;code>key-slot=1&lt;/code> points the keyfile straight at its own keyslot: &lt;code>luksFormat&lt;/code> put the passphrase in slot 0, and &lt;code>luksAddKey&lt;/code> put the keyfile in slot 1.
Without it, cryptsetup tries the keyslots in order, so the keyfile first goes through slot 0&amp;rsquo;s full Argon2id key derivation and fails before it reaches slot 1.
On the J4105, every derivation takes seconds, so this roughly halves the unlock time.
Unlocking still takes several seconds, so the &lt;code>fstab&lt;/code> line for HDD 1 waits up to 20 seconds for the unlocked device; the other timeouts only wait for a disk to appear.
HDD 1&amp;rsquo;s drive supports TRIM, but the WD Elements&amp;rsquo; USB bridge rejects it (&lt;code>WRITE SAME(16)&lt;/code>: invalid command operation code), so the &lt;code>crypttab&lt;/code> line has no &lt;code>discard&lt;/code>.
The immutable flag on the empty mount points makes every write fail while a disk is missing.
That matters because the root filesystem is BTRFS too: without it, BTRBK would happily receive its snapshots onto the SSD.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo install -d -m &lt;span class="m">0755&lt;/span> /mnt/btrbk /mnt/backup
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo chattr +i /mnt/btrbk /mnt/backup
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># The keyfile must open slot 1, which the crypttab line below relies on&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cryptsetup open --test-passphrase --key-slot &lt;span class="m">1&lt;/span> --key-file /etc/cryptsetup-keys.d/wyse-btrbk.key &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1 &lt;span class="o">&amp;amp;&amp;amp;&lt;/span> &lt;span class="nb">echo&lt;/span> &lt;span class="s1">&amp;#39;slot 1 ok&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># slot 1 ok&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">luks_uuid&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>sudo cryptsetup luksUUID &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$HDD1&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>-part1&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> &lt;span class="s2">&amp;#34;wyse-btrbk UUID=&lt;/span>&lt;span class="nv">$luks_uuid&lt;/span>&lt;span class="s2"> /etc/cryptsetup-keys.d/wyse-btrbk.key luks,key-slot=1,nofail,x-systemd.device-timeout=10s&amp;#34;&lt;/span> &lt;span class="p">|&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> sudo tee -a /etc/crypttab
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo tee -a /etc/fstab &amp;gt;/dev/null &lt;span class="s">&amp;lt;&amp;lt;&amp;#39;FSTAB&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">/dev/mapper/wyse-btrbk /mnt/btrbk btrfs defaults,noatime,compress=zstd:3,nofail,x-systemd.device-timeout=20s 0 0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">LABEL=wyse-borg /mnt/backup btrfs defaults,noatime,nofail,x-systemd.device-timeout=10s 0 0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">FSTAB&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl daemon-reload
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl start mnt-btrbk.mount mnt-backup.mount
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo findmnt --verify --verbose
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Success, no errors or warnings detected&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">findmnt /mnt/btrbk
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># TARGET SOURCE FSTYPE OPTIONS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /mnt/btrbk /dev/mapper/wyse-btrbk btrfs rw,noatime,compress=zstd:3,space_cache=v2,subvolid=5,subvol=/&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">findmnt /mnt/backup
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># TARGET SOURCE FSTYPE OPTIONS&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /mnt/backup /dev/sdc1 btrfs rw,noatime,space_cache=v2,subvolid=5,subvol=/&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo install -d -m &lt;span class="m">0700&lt;/span> /mnt/btrbk/wyse
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Starting &lt;code>mnt-btrbk.mount&lt;/code> unlocks HDD 1 through the same &lt;code>systemd-cryptsetup&lt;/code> unit that runs at boot, so this already tests the keyfile unlock that the boot uses.
A disk attached later is unlocked and mounted by the next job that needs it.&lt;/p>
&lt;h3 id="73-hourly-snapshots-and-daily-sendreceive-with-btrbk">7.3 Hourly snapshots and daily send/receive with BTRBK&lt;/h3>
&lt;p>The &lt;code>/etc/btrbk/btrbk.conf&lt;/code> copied at the start of &lt;a href="#7-backup-disks-snapshots-alerts-and-the-home-assistant-share">section 7&lt;/a> snapshots the five subvolumes that hold state into &lt;code>@snapshots&lt;/code>, keeps 48 hourly and 7 daily snapshots on the SSD, and keeps 30 daily, 12 weekly and 12 monthly copies on HDD 1.
Check the configuration and send the first copies:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo btrbk dryrun
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo btrbk run
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo btrbk list latest
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># SOURCE_SUBVOLUME SNAPSHOT_SUBVOLUME STATUS TARGET_SUBVOLUME&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /mnt/wyse-top/@root /mnt/wyse-top/@snapshots/@root.20261116T1355 - /mnt/btrbk/wyse/@root.20261116T1355&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /mnt/wyse-top/@home /mnt/wyse-top/@snapshots/@home.20261116T1355 up-to-date /mnt/btrbk/wyse/@home.20261116T1355&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /mnt/wyse-top/@docker /mnt/wyse-top/@snapshots/@docker.20261116T1355 up-to-date /mnt/btrbk/wyse/@docker.20261116T1355&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /mnt/wyse-top/@nextcloud /mnt/wyse-top/@snapshots/@nextcloud.20261116T1355 up-to-date /mnt/btrbk/wyse/@nextcloud.20261116T1355&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># /mnt/wyse-top/@ha-backups /mnt/wyse-top/@snapshots/@ha-backups.20261116T1355 up-to-date /mnt/btrbk/wyse/@ha-backups.20261116T1355&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The first &lt;code>run&lt;/code> sends complete copies.
Doing it now, while the subvolumes are nearly empty, keeps it short; every later send is incremental.
After a restore or an import, the next daily send carries the new data once, which takes a few hours to days on a USB HDD.&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Hung-task warnings from HDD 1 during large sends.&lt;/strong>
The WD Elements used as HDD 1 here, a 2.5″ WD60NDZW, is a drive-managed SMR disk: once its internal cache fills, scattered writes slow to a crawl.
A send that carries a lot of new data, especially many small files such as freshly pulled Docker images, is exactly that.
The Wyse&amp;rsquo;s RAM buffers gigabytes of it, and at the end of each subvolume &lt;code>btrfs receive&lt;/code> sets the copy read-only, which forces a transaction commit that has to wait for all of it to reach the disk.
If that takes longer than two minutes, the kernel logs messages like these, which &lt;code>sudo dmesg --level=err&lt;/code> shows:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">INFO: task btrfs-transacti:7587 blocked for more than 122 seconds.
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">INFO: task btrfs:376545 blocked for more than 245 seconds.
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The call traces show &lt;code>btrfs_btree_wait_writeback_range&lt;/code> and &lt;code>btrfs_ioctl_subvol_setflags&lt;/code>.
This is a slow disk, not a failing one, as long as all of these hold:&lt;/p>
&lt;ul>
&lt;li>&lt;code>dell-wyse-btrbk-send.service&lt;/code> still finishes successfully, and &lt;code>sudo btrbk list latest&lt;/code> shows today&amp;rsquo;s copies on HDD 1.&lt;/li>
&lt;li>&lt;code>sudo btrfs device stats --check /mnt/btrbk&lt;/code> reports zero errors.&lt;/li>
&lt;li>The kernel log shows no USB resets or &lt;code>I/O error&lt;/code> lines for the disk: &lt;code>journalctl -k -b | grep -iE 'reset|I/O error'&lt;/code>.&lt;/li>
&lt;li>&lt;code>sudo smartctl -a&lt;/code> on HDD 1 shows no reallocated, pending or CRC errors.&lt;/li>
&lt;/ul>
&lt;p>The messages don&amp;rsquo;t name the filesystem.
Each mounted BTRFS has its own &lt;code>btrfs-transaction&lt;/code> kernel thread, started when it was mounted, so &lt;code>ps -o pid,lstart,comm -C btrfs-transaction&lt;/code> next to the mount times in &lt;code>journalctl -b | grep 'first mount'&lt;/code> tells you which disk the PID belongs to.
To keep each nightly send short, upload or import large amounts of data in chunks of a few dozen GB per day rather than all at once.&lt;/p>
&lt;/div>
&lt;/div>
&lt;p>Two timers split the work.
&lt;code>dell-wyse-btrbk-snapshot&lt;/code> runs &lt;code>btrbk snapshot&lt;/code> hourly, which creates and prunes snapshots on the SSD and only reads HDD 1 to find the latest snapshot/backup pair it must keep.
While HDD 1 is not mounted, BTRBK keeps every snapshot, so that the send can later catch up on the missed days, and the hourly job fails and alerts until HDD 1 is back.
&lt;code>dell-wyse-btrbk-send&lt;/code> runs &lt;code>btrbk resume&lt;/code> daily.
It sends every snapshot that HDD 1&amp;rsquo;s retention still needs, incrementally, including days missed while the disk was detached.
BTRBK always keeps the latest snapshot pair it needs for the next incremental send.
A shared &lt;code>flock&lt;/code> makes the two wait for each other instead of failing.
The send timer first fires at 01:30, so the second command runs the send once right away.
It finds today&amp;rsquo;s copies already on HDD 1, finishes in seconds and creates the check &lt;code>dell-wyse-btrbk-send&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo systemctl &lt;span class="nb">enable&lt;/span> --now dell-wyse-btrbk-snapshot.timer dell-wyse-btrbk-send.timer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl start dell-wyse-btrbk-send.service
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl list-timers &lt;span class="s1">&amp;#39;dell-wyse-*&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># NEXT LEFT LAST PASSED UNIT ACTIVATES &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Mon 2026-11-16 14:00:00 CET 2min 48s Mon 2026-11-16 13:55:07 CET 2min 4s ago dell-wyse-alive.timer dell-wyse-alive.service&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Mon 2026-11-16 14:00:00 CET 2min 48s - - dell-wyse-btrbk-snapshot.timer dell-wyse-btrbk-snapshot.service&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Tue 2026-11-17 01:30:00 CET 11h - - dell-wyse-btrbk-send.timer dell-wyse-btrbk-send.service&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Getting something back.&lt;/strong>
Nextcloud&amp;rsquo;s own trash and file versions come first.
Beyond those, snapshots are browsable read-only directories, named by subvolume and time: &lt;code>@snapshots&lt;/code> on the SSD, &lt;code>/mnt/btrbk/wyse&lt;/code> on HDD 1.
For a Nextcloud file, copy it back into the user&amp;rsquo;s folder with its ownership, then let Nextcloud index it:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo ls /mnt/wyse-top/@snapshots/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo cp -a --reflink&lt;span class="o">=&lt;/span>auto &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s1">&amp;#39;/mnt/wyse-top/@snapshots/@nextcloud.20261115T1400/data/USER_ID/files/FOLDER&amp;#39;&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s1">&amp;#39;/srv/nextcloud/data/USER_ID/files/FOLDER-restored&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> --user www-data nextcloud-aio-nextcloud &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> php occ files:scan --path&lt;span class="o">=&lt;/span>&lt;span class="s1">&amp;#39;/USER_ID/files/FOLDER-restored&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;/div>
&lt;/div>
&lt;p>Space freed by deleting large amounts of data, such as import staging, returns only when the last snapshot referencing it expires, after up to seven days on the SSD, as long as the daily send succeeds.&lt;/p>
&lt;h3 id="74-disk-health-monthly-scrub-and-smart-monitoring">7.4 Disk health: monthly scrub and SMART monitoring&lt;/h3>
&lt;p>A scrub reads everything and verifies checksums.
It finds errors, but a single-copy data block cannot be repaired without another good copy; that is what the HDD copies are for.
&lt;code>dell-wyse-scrub&lt;/code> runs on the first of the month at 10:00, away from the nightly jobs, and scrubs the Vi560 and both HDDs one after another.
Then it checks the error counters of all three with &lt;code>btrfs device stats --check&lt;/code>, so read, write and checksum errors also fail the job.
The counters persist: after dealing with an error, reset them with &lt;code>sudo btrfs device stats -z&lt;/code> on that filesystem, or every later scrub reports again.
The assertions make the job fail visibly if an HDD is missing, rather than scrubbing the SSD twice.
The timer first fires on the first of next month, so the second command runs the scrub once right away; while the disks hold little data, that takes about a minute.
It also creates the check &lt;code>dell-wyse-scrub&lt;/code> now, so you can set its 31-day period (&lt;a href="#71-alerts-to-healthchecksio">section 7.1&lt;/a>) before healthchecks.io&amp;rsquo;s default of one day sends a false alert:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo systemctl &lt;span class="nb">enable&lt;/span> --now dell-wyse-scrub.timer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl start dell-wyse-scrub.service
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="alert alert-warning">
&lt;div>
&lt;strong>Never run a full balance or an automatic &lt;code>btrfs check --repair&lt;/code>.&lt;/strong>
A full balance rewrites every block on the disk without any benefit here.
&lt;code>btrfs check --repair&lt;/code> can turn a damaged but readable filesystem into a lost one; its manual reserves it for cases where a developer or an experienced user advises it, after you have accepted that it may fail.
&lt;/div>
&lt;/div>
&lt;p>SMART catches a failing disk before BTRFS does.
The repository&amp;rsquo;s &lt;code>/etc/smartd.conf&lt;/code> watches every disk &lt;code>smartd&lt;/code> finds when it starts: overall health, error and self-test logs, attribute changes and temperature, with an alert at 60 °C.
It runs a short self-test every Sunday and a long one on the 15th of each month, both at 11:00, and does not wake HDDs in standby for its half-hourly checks.
Instead of sending mail, it hands each problem to &lt;code>dell-wyse-smartd-alert&lt;/code>, which forwards it to the &lt;code>dell-wyse-smartd&lt;/code> check.
The &lt;code>smartmontools&lt;/code> package from &lt;a href="#51-packages-updates-and-disk-health">section 5.1&lt;/a> pulls in no mail server.&lt;/p>
&lt;p>Check that each disk answers, then restart &lt;code>smartd&lt;/code> with the new configuration and confirm that it found all three:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo smartctl -H /dev/disk/by-id/ata-Verbatim_Vi560_493653348990842
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo smartctl -H /dev/disk/by-id/usb-WD_Elements_2621_57583632443334335444584A-0:0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo smartctl -H /dev/disk/by-id/usb-TOSHIBA_External_USB_3.0_20201028020375F-0:0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl restart smartmontools.service
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo journalctl -u smartmontools.service -b --no-pager
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>SMART on USB disks.&lt;/strong>
USB bridges differ in what they pass on to the drive, and &lt;code>smartctl&lt;/code> and the journal show where yours falls short:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>&lt;code>SMART Disabled&lt;/code>&lt;/strong> from &lt;code>smartctl -H&lt;/code>: the drive ships with SMART switched off.
Switch it on once with &lt;code>sudo smartctl -s on /dev/disk/by-id/usb-…&lt;/code>; the drive keeps the setting.&lt;/li>
&lt;li>&lt;strong>No answer without &lt;code>-d sat&lt;/code>:&lt;/strong> some enclosures answer only with &lt;code>-d sat&lt;/code> added to &lt;code>smartctl&lt;/code>.
If &lt;code>smartd&lt;/code> skips such a disk, list it in &lt;code>/etc/smartd.conf&lt;/code> by its &lt;code>/dev/disk/by-id/usb-…&lt;/code> path with &lt;code>-d sat&lt;/code>, as the file&amp;rsquo;s comment shows.&lt;/li>
&lt;li>&lt;strong>&lt;code>not capable of SMART Health Status check&lt;/code>:&lt;/strong> the bridge cannot pass on the drive&amp;rsquo;s own pass/fail verdict.
&lt;code>smartd&lt;/code> still watches the attributes, the error and self-test logs and the temperature.&lt;/li>
&lt;li>&lt;strong>&lt;code>no ATA CHECK POWER STATUS support, ignoring -n Directive&lt;/code>:&lt;/strong> &lt;code>smartd&lt;/code> cannot see that the disk sleeps and would wake it at every check.
Give the disk a line of its own with a longer interval, such as &lt;code>-c i=21600&lt;/code> for six hours, and &lt;code>-d removable&lt;/code>, so that &lt;code>smartd&lt;/code> still starts while the disk is detached.
The repository&amp;rsquo;s &lt;code>smartd.conf&lt;/code> does this for HDD 2.&lt;/li>
&lt;/ul>
&lt;p>Make such changes in the repository, then copy &lt;code>smartd.conf&lt;/code> again as at the start of &lt;a href="#7-backup-disks-snapshots-alerts-and-the-home-assistant-share">section 7&lt;/a> and restart &lt;code>smartd&lt;/code>.
&lt;code>smartd&lt;/code> scans for disks only when it starts, so restart it also after attaching an HDD that was missing at boot.&lt;/p>
&lt;/div>
&lt;/div>
&lt;p>Finally, test the alert path and set the check back to up:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo env &lt;span class="nv">SMARTD_DEVICE&lt;/span>&lt;span class="o">=&lt;/span>/dev/test &lt;span class="nv">SMARTD_FAILTYPE&lt;/span>&lt;span class="o">=&lt;/span>Test &lt;span class="nv">SMARTD_MESSAGE&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s1">&amp;#39;Test alert&amp;#39;&lt;/span> /usr/local/sbin/dell-wyse-smartd-alert
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo dell-wyse-hc-ping smartd
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="75-backup-share-for-home-assistant">7.5 Backup share for Home Assistant&lt;/h3>
&lt;p>Samba serves one share, &lt;code>ha-backups&lt;/code>, to one account, and accepts connections only from the Raspberry Pi at &lt;code>192.168.178.50&lt;/code>.
Its configuration is the &lt;code>/etc/samba/smb.conf&lt;/code> copied at the start of &lt;a href="#7-backup-disks-snapshots-alerts-and-the-home-assistant-share">section 7&lt;/a>: SMB 3 only, port 445 only, no NetBIOS, no guest access, no printing, and only the onboard interface &lt;code>enp1s0&lt;/code>.
Change that interface name in the repository if yours differs, and copy the file again.
The backups land on the &lt;code>@ha-backups&lt;/code> subvolume, so they are snapshotted hourly, reach HDD 1 every night and go off-site with the mirror.
Home Assistant encrypts them with the key from its emergency kit, so neither the share nor the off-site copy ever holds readable HA data.
My post &lt;a href="https://mutschler.dev/linux/raspi-home-assistant-os/">Home Assistant OS on a Raspberry Pi 4&lt;/a> covers the Pi&amp;rsquo;s side in more detail.&lt;/p>
&lt;h4 id="751-steps-on-the-wyse">7.5.1 Steps on the Wyse&lt;/h4>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo adduser --system --group --no-create-home --shell /usr/sbin/nologin hass-backup
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo smbpasswd -a hass-backup
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo chown hass-backup:hass-backup /srv/ha-backups
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo chmod &lt;span class="m">0700&lt;/span> /srv/ha-backups
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo testparm -s
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl restart smbd
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ufw allow in on enp1s0 from 192.168.178.50 to any port &lt;span class="m">445&lt;/span> proto tcp
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ufw status verbose
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># To Action From&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># -- ------ ----&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 22/tcp on enp1s0 ALLOW IN 192.168.178.0/24 &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 445/tcp on enp1s0 ALLOW IN 192.168.178.50 &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ss -lntup &lt;span class="p">|&lt;/span> grep -E &lt;span class="s1">&amp;#39;:(139|445) &amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># tcp LISTEN 0 50 127.0.0.1:445 0.0.0.0:* users:((&amp;#34;smbd&amp;#34;,pid=8739,fd=31)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># tcp LISTEN 0 50 192.168.178.55:445 0.0.0.0:* users:((&amp;#34;smbd&amp;#34;,pid=8739,fd=28)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># tcp LISTEN 0 50 [::1]:445 [::]:* users:((&amp;#34;smbd&amp;#34;,pid=8739,fd=32)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># tcp LISTEN 0 50 [fd00:db8::55]:445 [::]:* users:((&amp;#34;smbd&amp;#34;,pid=8739,fd=29)) &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># tcp LISTEN 0 50 [2001:db8::55]:445 [::]:* users:((&amp;#34;smbd&amp;#34;,pid=8739,fd=30)) &lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Store the Samba password in your password manager.
&lt;code>ss&lt;/code> should show &lt;code>smbd&lt;/code> on port 445 only, and no NetBIOS port 139.
Substitute your interface name if it is not &lt;code>enp1s0&lt;/code>.&lt;/p>
&lt;h4 id="752-steps-in-home-assistant-on-the-pi">7.5.2 Steps in Home Assistant on the Pi&lt;/h4>
&lt;ol>
&lt;li>&lt;strong>Settings → System → Storage → Add storage.&lt;/strong>
Name &lt;code>dell_wyse&lt;/code> (Home Assistant allows only letters, digits and underscores here), usage &lt;strong>Backup&lt;/strong>, type &lt;strong>Samba/Windows (CIFS)&lt;/strong>, server &lt;code>192.168.178.55&lt;/code>, remote share &lt;code>ha-backups&lt;/code>, username &lt;code>hass-backup&lt;/code> and its password.
Select &lt;strong>Connect&lt;/strong>.
If it asks for a CIFS version, keep &lt;strong>Auto (2.1+)&lt;/strong>; the share requires SMB 3.&lt;/li>
&lt;li>&lt;strong>Settings → System → Backups → Configure backup settings.&lt;/strong>
Schedule daily backups at the &lt;strong>System optimal&lt;/strong> time, set the retention, for example 7 backups, and turn on the location &lt;code>dell_wyse&lt;/code>.
Pruned HA backups stay in the Wyse&amp;rsquo;s snapshots on HDD 1 for months, so a short retention is enough.
Keep &lt;strong>This system&lt;/strong> as well, for quick restores on the Pi itself.
Leave encryption on for &lt;code>dell_wyse&lt;/code>.&lt;/li>
&lt;li>Download the &lt;strong>emergency kit&lt;/strong> from the &lt;strong>Encryption key&lt;/strong> card and store it in your password manager.
Without that key, the backups on the Wyse and off-site cannot be restored.&lt;/li>
&lt;li>Create a backup now.&lt;/li>
&lt;/ol>
&lt;h4 id="753-checks">7.5.3 Checks&lt;/h4>
&lt;ol>
&lt;li>
&lt;p>On the Wyse, &lt;code>sudo ls -lhR /srv/ha-backups&lt;/code> should show the backup you just created.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Enable the daily delivery check on the &lt;strong>Wyse&lt;/strong>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo systemctl &lt;span class="nb">enable&lt;/span> --now dell-wyse-ha-backup-check.timer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl start dell-wyse-ha-backup-check.service
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Every morning at 07:00, it fails, and alerts, unless the share holds a backup newer than 26 hours.
That also catches a dead Pi, a stopped HA, a broken share or a full disk, none of which anything on the Pi could report.
When only the upload fails, HA also raises the repair &amp;ldquo;Automatic backup could not be uploaded to the configured locations&amp;rdquo; under &lt;strong>Settings → System → Repairs&lt;/strong>.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>See &lt;a href="https://www.home-assistant.io/common-tasks/os/#network-storage" target="_blank" rel="noopener">Home Assistant network storage&lt;/a> and &lt;a href="https://www.home-assistant.io/common-tasks/general/backups/" target="_blank" rel="noopener">Home Assistant backups&lt;/a> for more details.&lt;/p>
&lt;h3 id="76-off-site-mirror-on-a-hetzner-storage-box">7.6 Off-site mirror on a Hetzner Storage Box&lt;/h3>
&lt;p>&lt;code>dell-wyse-offsite&lt;/code> copies two things that are encrypted before they leave the house: AIO&amp;rsquo;s Borg repository from HDD 2, and the HA backups.
It starts at 06:30 and first waits until AIO&amp;rsquo;s backup container and any Borg lock are gone.
Then it copies the repository in three passes: new data segments first, then the index files that reference them, and only then deletions.
So once the first run has finished, even an interrupted run leaves a usable repository on the Storage Box; at worst it holds some newer segments, which the restore in &lt;a href="#77-restore-from-the-storage-box">section 7.7&lt;/a> removes.
The job also fails if the Borg repository has not changed in 26 hours, which catches an AIO backup that never ran.&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Storage Box.&lt;/strong>
Order one in the Hetzner Console, sized for the Borg repository plus growth and snapshots: with about 860 GiB of Nextcloud data, the 1 TB box is too small.
A smaller box can be enlarged later on its tab &lt;strong>Rescale&lt;/strong>, without losing data or sub-accounts.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Project:&lt;/strong> create a Console project of its own for it, for example &lt;code>backup&lt;/code>, and create no API tokens in it: a project&amp;rsquo;s read/write token can delete the box&amp;rsquo;s snapshots.&lt;/li>
&lt;li>&lt;strong>Access:&lt;/strong> unselect any SSH key and use &lt;strong>Generate a password&lt;/strong> only.
The key in the order form would authorize the main account; the Wyse&amp;rsquo;s key goes to its sub-account in step 4.
Store the password in your password manager; the Wyse needs it only to copy from a snapshot (&lt;a href="#77-restore-from-the-storage-box">section 7.7&lt;/a>, step 3).&lt;/li>
&lt;li>&lt;strong>Additional settings:&lt;/strong> leave SMB, WebDAV, SSH and external reachability off for the main account, unless something else uses them.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Automatic snapshots.&lt;/strong>
On the box&amp;rsquo;s tab &lt;strong>Snapshots&lt;/strong>, choose &lt;strong>Enable automatic snapshots&lt;/strong>: interval &lt;strong>Daily&lt;/strong>, the highest &lt;strong>Max. amount&lt;/strong> the box allows, and an execution time in the afternoon, after the nightly copy, for example &lt;code>13:00&lt;/code> UTC.
The time is UTC and does not follow daylight saving time, so 13:00 is 14:00 in winter and 15:00 in summer in Germany.
These snapshots protect the mirror when the Wyse is compromised or a sync copies a damaged repository: they are managed only in the Hetzner Console, never through the SSH key that the Wyse holds.
They count against the box&amp;rsquo;s space, and when the maximum is reached, the oldest is deleted.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Sub-account.&lt;/strong>
Give the Wyse a sub-account of its own, so that its key reaches nothing else on the box, such as other machines&amp;rsquo; backups added later.
On the box&amp;rsquo;s tab &lt;strong>Subaccounts&lt;/strong>, choose &lt;strong>Create subaccount&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Base directory:&lt;/strong> &lt;code>dell-wyse&lt;/code>.
It becomes the sub-account&amp;rsquo;s home directory, and the main account sees the copies under this name.&lt;/li>
&lt;li>&lt;strong>Additional settings:&lt;/strong> turn on &lt;strong>Allow SSH&lt;/strong> and &lt;strong>External reachability&lt;/strong>.
Leave &lt;strong>Allow SMB&lt;/strong> and &lt;strong>Allow WebDAV&lt;/strong> off, and do not make it &lt;strong>Read-Only&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>Password:&lt;/strong> generate one and store it in your password manager; step 4 asks for it once.&lt;/li>
&lt;li>&lt;strong>Description:&lt;/strong> for example &lt;code>Dell Wyse Thin Client 5070&lt;/code>.&lt;/li>
&lt;/ul>
&lt;p>The list then shows the sub-account&amp;rsquo;s user, such as &lt;code>u123456-sub1&lt;/code>; its login is &lt;code>u123456-sub1@u123456.your-storagebox.de&lt;/code>.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>SSH key.&lt;/strong>
Create a key that only root on the Wyse uses, and authorize it for the sub-account.
Port 23 is the Storage Box&amp;rsquo;s SSH service with rsync; port 22 speaks only SFTP and SCP.
&lt;code>-s&lt;/code> makes &lt;code>ssh-copy-id&lt;/code> work with the box&amp;rsquo;s restricted shell, and it asks for the sub-account&amp;rsquo;s password once.
Compare the host key fingerprint with the one Hetzner publishes.
Replace &lt;code>u123456-sub1&lt;/code> and &lt;code>u123456&lt;/code> with your sub-account&amp;rsquo;s user and your box&amp;rsquo;s main user:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo install -d -m &lt;span class="m">0700&lt;/span> /root/.ssh
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ssh-keygen -t ed25519 -N &lt;span class="s1">&amp;#39;&amp;#39;&lt;/span> -C dell-wyse-offsite -f /root/.ssh/dell-wyse-offsite
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ssh-copy-id -p &lt;span class="m">23&lt;/span> -s -i /root/.ssh/dell-wyse-offsite.pub u123456-sub1@u123456.your-storagebox.de
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ssh -p &lt;span class="m">23&lt;/span> -i /root/.ssh/dell-wyse-offsite u123456-sub1@u123456.your-storagebox.de ls -al
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># total 10&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># drwxr-xr-x 3 u123456-sub1 1113 3 Nov 17 12:40 .&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># dr-x--x--x 7 root root 11 Nov 17 12:36 ..&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># drwx------ 2 u123456-sub1 1113 3 Nov 17 12:40 .ssh&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>ls -al&lt;/code> lists the sub-account&amp;rsquo;s home directory, still empty apart from what &lt;code>ssh-copy-id&lt;/code> put there.
That directory is all the key can reach.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Settings.&lt;/strong>
In &lt;code>/etc/dell-wyse/host.env&lt;/code>, set &lt;code>OFFSITE_TARGET&lt;/code> to the sub-account&amp;rsquo;s login, &lt;code>u123456-sub1@u123456.your-storagebox.de&lt;/code>.
For the first upload, also set &lt;code>OFFSITE_BWLIMIT&lt;/code>, for example to &lt;code>2500&lt;/code> KiB/s, about 20 Mbit/s, so that Nextcloud stays usable from outside while it runs:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudoedit /etc/dell-wyse/host.env
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>&lt;strong>First upload, after the first AIO backup&lt;/strong> (&lt;a href="#933-path-a-first-steps-in-the-new-nextcloud">section 9.3.3&lt;/a> or &lt;a href="#944-path-b-restore-in-aio">9.4.4&lt;/a>).
Until AIO has created the repository, the job has nothing to copy, so start it only then, by hand.
The first run copies the whole repository, which takes days at a typical home upload rate.
AIO&amp;rsquo;s nightly backups during that time only make the job copy again what changed.
An interrupted run fails with an alert, and the next run continues where rsync stopped.
The timer does not start a second run while the first is still busy, and the daily snapshots taken meanwhile hold a partial mirror until they rotate out.
To change &lt;code>OFFSITE_BWLIMIT&lt;/code> during the upload, edit it, then stop and start the job: the cut-off segment resumes, and the stop sends one failure alert.
Once the check &lt;code>dell-wyse-offsite&lt;/code> appears green in healthchecks.io, set its period and grace time (&lt;a href="#71-alerts-to-healthchecksio">section 7.1&lt;/a>) and clear &lt;code>OFFSITE_BWLIMIT&lt;/code>; the next run reads it.
Start the job, enable the timer and follow the journal:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo systemctl start --no-block dell-wyse-offsite.service
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl &lt;span class="nb">enable&lt;/span> --now dell-wyse-offsite.timer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo journalctl -fu dell-wyse-offsite.service &lt;span class="c1"># keep open, it prints &amp;#34;Finished...&amp;#34; or &amp;#34;Failed&amp;#34;, or close it with &amp;#34;CTRL+C&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ol>
&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Monitoring a running upload.&lt;/strong>
The journal stays silent after &amp;ldquo;Starting…&amp;rdquo;, because rsync prints nothing; the job is still working as long as &lt;code>systemctl status&lt;/code> says &lt;code>activating (start)&lt;/code>.
&lt;code>pgrep -a rsync&lt;/code> shows the pass: &lt;code>--include=/data/***&lt;/code> is the bulk of the data segments, &lt;code>--exclude=/data&lt;/code> the index files, &lt;code>--delete&lt;/code> with &lt;code>/mnt/backup/borg/&lt;/code> the cleanup, and &lt;code>/srv/ha-backups/&lt;/code> the HA copy at the very end.
No rsync process means that the job is waiting for AIO&amp;rsquo;s backup or a Borg lock to finish, for up to four hours.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">systemctl status dell-wyse-offsite.service --no-pager
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">pgrep -a rsync
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo du -sh /mnt/backup/borg &lt;span class="c1"># the total to copy&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo bash -c &lt;span class="s1">&amp;#39;. /etc/dell-wyse/host.env; ssh -p &amp;#34;${OFFSITE_PORT:-23}&amp;#34; -i /root/.ssh/dell-wyse-offsite &amp;#34;$OFFSITE_TARGET&amp;#34; du -sh borg&amp;#39;&lt;/span> &lt;span class="c1"># arrived so far&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;/div>
&lt;/div>
&lt;p>The copies are in &lt;code>borg/&lt;/code> and &lt;code>ha-backups/&lt;/code> in the sub-account&amp;rsquo;s home directory, which the main account sees as &lt;code>dell-wyse/&lt;/code>.
&lt;a href="https://docs.hetzner.com/storage/storage-box/access/access-ssh-rsync-borg/" target="_blank" rel="noopener">Storage Box access&lt;/a> and &lt;a href="https://docs.hetzner.com/storage/storage-box/snapshots/" target="_blank" rel="noopener">Storage Box snapshots&lt;/a> provide further information.&lt;/p>
&lt;div class="alert alert-warning">
&lt;div>
&lt;strong>The Storage Box copy is a mirror.&lt;/strong>
Never point AIO or Borg at it while the Wyse still writes to HDD 2: two diverging copies of one encrypted Borg repository are unsafe.
&lt;/div>
&lt;/div>
&lt;p>To restore from it, follow &lt;a href="#77-restore-from-the-storage-box">section 7.7&lt;/a>: it stops the mirror job, copies the repository next to its final place on HDD 2 and prepares it before AIO opens it.&lt;/p>
&lt;h3 id="77-restore-from-the-storage-box">7.7 Restore from the Storage Box&lt;/h3>
&lt;p>Follow these steps when HDD 2 is lost or its repository is damaged.
If HDD 2 itself is lost, first prepare its replacement: set &lt;code>HDD2&lt;/code> in the first block of &lt;a href="#721-new-hdds-partition-and-encrypt">section 7.2.1&lt;/a> and run only the HDD 2 block there, never the whole subsection.
Then mount it as the note &lt;strong>Replacing a single HDD&lt;/strong> at the start of &lt;a href="#723-unlock-and-mount-the-hdds-at-boot">section 7.2.3&lt;/a> says.&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Stop the mirror job&lt;/strong>, including a run in progress, so that no nightly run copies a half-restored repository over the good copy:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo systemctl disable --now dell-wyse-offsite.timer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo systemctl stop dell-wyse-offsite.service
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>&lt;strong>Copy the repository&lt;/strong> into &lt;code>/mnt/backup/borg.restore&lt;/code>, next to its final place, so that the job finds no repository until it is complete.
Copy the HA backups back into &lt;code>/srv/ha-backups&lt;/code> as well: the job refuses to mirror an empty share, but a half-filled one would replace the Storage Box&amp;rsquo;s HA backups.
Both rsync commands read everything through your home download, which takes hours:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo bash -c &lt;span class="s1">&amp;#39;. /etc/dell-wyse/host.env; ssh=&amp;#34;ssh -p ${OFFSITE_PORT:-23} -i /root/.ssh/dell-wyse-offsite&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1"> rsync -a --info=progress2 -e &amp;#34;$ssh&amp;#34; &amp;#34;$OFFSITE_TARGET:borg/&amp;#34; /mnt/backup/borg.restore/ &amp;amp;&amp;amp;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1"> rsync -a -e &amp;#34;$ssh&amp;#34; &amp;#34;$OFFSITE_TARGET:ha-backups/&amp;#34; /srv/ha-backups/&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Give the HA backups back to the share&amp;#39;s account, so HA can rotate them&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo chown -R hass-backup:hass-backup /srv/ha-backups
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>&lt;strong>Prepare the copy before AIO or Borg opens it.&lt;/strong>
A run that broke off in its first pass can leave newer segments with gaps, because rsync copies in name order, and Borg would replay them when it opens the repository.
The script below removes them.
It also moves Borg&amp;rsquo;s nonce counter far past anything those segments, or a newer copy elsewhere, may have used: Borg encrypts with AES-CTR, and a counter must never be used twice.
If the script refuses, the lines after it do not run.
If a damaged repository is still in &lt;code>/mnt/backup/borg&lt;/code>, move it aside first, for example to &lt;code>/mnt/backup/borg.damaged&lt;/code>: &lt;code>mv -T&lt;/code> does not replace it.
&lt;code>borg check&lt;/code> asks for the Borg password:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo apt install --no-install-recommends borgbackup -y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo bash -euo pipefail &lt;span class="s">&amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; &amp;amp;&amp;amp;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">cd /mnt/backup/borg.restore
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">[ -f config ] &amp;amp;&amp;amp; [ -s nonce ] || { echo &amp;#34;Not a complete Borg repository&amp;#34; &amp;gt;&amp;amp;2; exit 1; }
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s"># The newest non-empty index names the last transaction the copy holds completely
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">n=$(find . -maxdepth 1 -type f -size +0 -name &amp;#39;index.*&amp;#39; -printf &amp;#39;%f\n&amp;#39; |
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s"> sed -n &amp;#39;s/^index\.\([0-9][0-9]*\)$/\1/p&amp;#39; | sort -n | tail -n 1)
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">[ -n &amp;#34;$n&amp;#34; ] || { echo &amp;#34;No index: this copy never finished a run&amp;#34; &amp;gt;&amp;amp;2; exit 1; }
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">[ -n &amp;#34;$(find data -mindepth 2 -maxdepth 2 -type f -size +0 -name &amp;#34;$n&amp;#34;)&amp;#34; ] ||
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s"> { echo &amp;#34;Segment $n, which index.$n needs, is missing: run step 2 again if it broke off, else copy from a snapshot (section 7.7, step 3)&amp;#34; &amp;gt;&amp;amp;2; exit 1; }
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s"># Drop the segments newer than that transaction, then move the nonce counter ahead by 2^40
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">find data -mindepth 2 -maxdepth 2 -type f -printf &amp;#39;%f %p\n&amp;#39; |
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s"> awk -v n=&amp;#34;$n&amp;#34; &amp;#39;$1 ~ /^[0-9]+$/ &amp;amp;&amp;amp; $1 + 0 &amp;gt; n + 0 { print $2 }&amp;#39; | xargs -r rm -v --
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">printf &amp;#39;%016x&amp;#39; $(( 0x$(cat nonce) + (1 &amp;lt;&amp;lt; 40) )) &amp;gt; nonce
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo mv -T /mnt/backup/borg.restore /mnt/backup/borg &lt;span class="o">&amp;amp;&amp;amp;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> sudo borg check /mnt/backup/borg
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If the script reports a missing segment, check that the copy in step 2 finished without an error; if it broke off, run step 2 again: rsync skips what it already copied.
If the copy was complete, the mirror itself is damaged, and only one of the box&amp;rsquo;s snapshots from before the damage helps.
Only the main account can read them: in the Hetzner Console, turn on its &lt;strong>SSH Support&lt;/strong> and &lt;strong>External Reachability&lt;/strong> under &lt;strong>Actions → Change settings&lt;/strong>, and &lt;strong>Display snapshot directory&lt;/strong> on the box&amp;rsquo;s tab &lt;strong>Snapshots&lt;/strong>.
On that tab, also choose &lt;strong>Disable automatic snapshots&lt;/strong>, so that no new snapshot pushes out the one you need; then check that the existing snapshots are still listed.
Never choose &lt;strong>Restore snapshot&lt;/strong> there: it rolls back the whole box and deletes all newer snapshots.
SSH can take a few minutes to start working, and every &lt;code>ssh&lt;/code> and &lt;code>rsync&lt;/code> below asks for the main account&amp;rsquo;s password.
Replace &lt;code>u123456&lt;/code> with your box&amp;rsquo;s main user and &lt;code>SNAPSHOT&lt;/code> with a snapshot from before the damage.
Its newest &lt;code>index.N&lt;/code> needs the segment &lt;code>data/D/N&lt;/code>, where &lt;code>D&lt;/code> is &lt;code>N&lt;/code> divided by 1000, rounded down; if that segment is missing there too, try an older snapshot:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo ssh -p &lt;span class="m">23&lt;/span> u123456@u123456.your-storagebox.de ls .zfs/snapshot &lt;span class="c1"># one directory per snapshot&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ssh -p &lt;span class="m">23&lt;/span> u123456@u123456.your-storagebox.de ls .zfs/snapshot/SNAPSHOT/dell-wyse/borg &lt;span class="c1"># its newest index.N&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ssh -p &lt;span class="m">23&lt;/span> u123456@u123456.your-storagebox.de ls -l .zfs/snapshot/SNAPSHOT/dell-wyse/borg/data/D/N
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo rm -rf /mnt/backup/borg.restore &lt;span class="c1"># the damaged copy&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo rsync -a --info&lt;span class="o">=&lt;/span>progress2 -e &lt;span class="s1">&amp;#39;ssh -p 23&amp;#39;&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> u123456@u123456.your-storagebox.de:.zfs/snapshot/SNAPSHOT/dell-wyse/borg/ /mnt/backup/borg.restore/
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then run this step&amp;rsquo;s commands again; the HA backups from step 2 stay as they are.
Afterwards, turn the main account&amp;rsquo;s &lt;strong>SSH Support&lt;/strong>, &lt;strong>External Reachability&lt;/strong> and &lt;strong>Display snapshot directory&lt;/strong> off again, and enable automatic snapshots again as in &lt;a href="#76-off-site-mirror-on-a-hetzner-storage-box">section 7.6&lt;/a>, step 2.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Use the repository.&lt;/strong>
If Nextcloud still runs on the Wyse, because only HDD 2 was lost, restore nothing: AIO keeps &lt;code>/mnt/backup&lt;/code> as its backup location and continues in the copied repository.
In AIO&amp;rsquo;s backup section, click &lt;strong>Create backup&lt;/strong> and wait until it succeeds, then enable the off-site timer again: &lt;code>sudo systemctl enable --now dell-wyse-offsite.timer&lt;/code>.
If that backup fails because Borg&amp;rsquo;s cache or security directory is newer than the repository, the Storage Box held an older state than the lost disk.
Then remove AIO&amp;rsquo;s Borg cache, as AIO&amp;rsquo;s own backup reset does, with &lt;code>sudo docker rm nextcloud-aio-borgbackup&lt;/code> and &lt;code>sudo docker volume rm nextcloud_aio_backup_cache&lt;/code>, and create the backup again; step 3 has already moved the nonce counter ahead, so this is safe.
If Nextcloud is lost too, restore through Path B (&lt;a href="#94-path-b-reinstall-from-an-aio-backup">section 9.4&lt;/a>) with this repository on HDD 2.
Enable the timer again in &lt;a href="#944-path-b-restore-in-aio">section 9.4.4&lt;/a>, step 7, once AIO has written its first new backup and &lt;code>/srv/ha-backups&lt;/code> holds HA&amp;rsquo;s backups: &lt;code>sudo systemctl enable --now dell-wyse-offsite.timer&lt;/code>.
To bring Home Assistant itself back, restore one of the HA backups through HA&amp;rsquo;s own backup page or during HA&amp;rsquo;s onboarding, with the emergency kit.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;h2 id="8-prepare-tailscale-for-the-host-and-the-sidecar">8 Prepare Tailscale for the host and the sidecar&lt;/h2>
&lt;p>Two tailnet nodes run on the Wyse.
The host itself joins as &lt;code>dell-wyse&lt;/code>, tagged &lt;code>tag:server&lt;/code>, for SSH from anywhere.
Nextcloud has a node of its own: the sidecar container &lt;code>nextcloud-tailscale&lt;/code> registers as &lt;code>nextcloud&lt;/code>, tagged &lt;code>tag:nextcloud&lt;/code>, and publishes Nextcloud through Serve and Funnel.
That keeps Nextcloud&amp;rsquo;s name and certificate independent of the host.
Tagged nodes have no key expiry.
Sidecars on my other machines keep &lt;code>tag:container&lt;/code>; separate tags let the policy treat each group differently and limit what the Wyse&amp;rsquo;s OAuth secret can do.
See &lt;a href="https://tailscale.com/docs/features/containers/docker" target="_blank" rel="noopener">Tailscale in Docker&lt;/a> for more on the sidecar pattern, and its &lt;a href="https://tailscale.com/docs/features/containers/docker/docker-params" target="_blank" rel="noopener">parameters&lt;/a> for the environment variables that the compose file uses.&lt;/p>
&lt;h3 id="81-tailscale-admin-console">8.1 Tailscale admin console&lt;/h3>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>DNS:&lt;/strong> note the DNS name of your tailnet, which this guide writes as &lt;code>tailnet-name.ts.net&lt;/code>, and confirm that MagicDNS and HTTPS Certificates are enabled.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Access controls:&lt;/strong> add or check the following tags, and the Funnel attribute for &lt;code>tag:nextcloud&lt;/code>, next to any existing entries (like &lt;code>tag:container&lt;/code>) that other machines depend on.
The host needs no Funnel:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-json" data-lang="json">&lt;span class="line">&lt;span class="cl">&lt;span class="s2">&amp;#34;tagOwners&amp;#34;&lt;/span>&lt;span class="err">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;tag:container&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;autogroup:admin&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;tag:nextcloud&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;autogroup:admin&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;tag:server&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;autogroup:admin&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>&lt;span class="err">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s2">&amp;#34;nodeAttrs&amp;#34;&lt;/span>&lt;span class="err">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>&lt;span class="nt">&amp;#34;target&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;tag:container&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span> &lt;span class="nt">&amp;#34;attr&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;funnel&amp;#34;&lt;/span>&lt;span class="p">]},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>&lt;span class="nt">&amp;#34;target&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;tag:nextcloud&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span> &lt;span class="nt">&amp;#34;attr&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;funnel&amp;#34;&lt;/span>&lt;span class="p">]},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">]&lt;/span>&lt;span class="err">,&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>&lt;strong>Optional, narrower access:&lt;/strong> with the default allow-all policy, every tailnet device can reach the Nextcloud AIO interface on port 8080 and SSH on the host.
The AIO passphrase and your SSH keys still protect them.
To narrow it down, allow 443 for every member, and 8080 and SSH only for admins:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-json" data-lang="json">&lt;span class="line">&lt;span class="cl">&lt;span class="s2">&amp;#34;grants&amp;#34;&lt;/span>&lt;span class="err">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;src&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;autogroup:member&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;dst&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;tag:nextcloud&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;ip&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;tcp:443&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;src&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;autogroup:admin&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;dst&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;tag:nextcloud&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;ip&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;tcp:8080&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>&lt;span class="nt">&amp;#34;src&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;autogroup:admin&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span> &lt;span class="nt">&amp;#34;dst&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;tag:server&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span> &lt;span class="nt">&amp;#34;ip&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;tcp:22&amp;#34;&lt;/span>&lt;span class="p">]},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">]&lt;/span>&lt;span class="err">,&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>These grants narrow anything only once the broad default rule, which allows &lt;code>*&lt;/code> to reach &lt;code>*:*&lt;/code>, is replaced by explicit rules for the rest of the tailnet.
The separate tags are what make that practical: a rule such as &lt;code>{&amp;quot;src&amp;quot;: [&amp;quot;*&amp;quot;], &amp;quot;dst&amp;quot;: [&amp;quot;tag:container&amp;quot;], &amp;quot;ip&amp;quot;: [&amp;quot;*&amp;quot;]}&lt;/code> keeps other Tailscale sidecars exactly as open as before, so only Nextcloud and the host change.
Add rules for whatever your own devices need from each other, and use the policy editor&amp;rsquo;s preview before saving.
Funnel traffic is not governed by these grants; it arrives through Tailscale&amp;rsquo;s ingress relays and is allowed by &lt;code>AllowFunnel&lt;/code> in the serve configuration.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>OAuth client&lt;/strong> (under &lt;strong>Settings → Trust credentials&lt;/strong>): create a separate client for the Wyse, with only the &lt;code>auth_keys&lt;/code> scope with write access (&lt;strong>Keys → Auth Keys&lt;/strong>) and only the tag &lt;code>tag:nextcloud&lt;/code>.
A leaked Wyse secret can then add nothing but &lt;code>tag:nextcloud&lt;/code> nodes, and other secrets stay as they are.
The sidecar must advertise exactly that tag, which the compose file does.
If device approval is enabled, append &lt;code>&amp;amp;preauthorized=true&lt;/code> to &lt;code>TS_AUTHKEY&lt;/code> in the compose file; see &lt;a href="https://tailscale.com/docs/features/oauth-clients" target="_blank" rel="noopener">OAuth clients&lt;/a> for more details.
Store the secret in your password manager.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;h3 id="82-on-the-wyse">8.2 On the Wyse&lt;/h3>
&lt;p>On &lt;strong>Ubuntu&lt;/strong>, install Tailscale from its signed repository, as with Docker in &lt;a href="#6-install-docker-with-storage-safeguards">section 6&lt;/a>, and log the host in with its tag.
&lt;code>tailscale up&lt;/code> prints a login link: open it on the Mac, signed in as an admin, and approve the device if device approval is on.&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
&lt;strong>A leftover &lt;code>dell-wyse&lt;/code> node.&lt;/strong>
If the admin console still lists a node called &lt;code>dell-wyse&lt;/code>, for example from an earlier installation, delete it first; otherwise the host becomes &lt;code>dell-wyse-1&lt;/code>.
&lt;/div>
&lt;/div>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="nv">codename&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>. /etc/os-release &lt;span class="o">&amp;amp;&amp;amp;&lt;/span> &lt;span class="nb">echo&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$VERSION_CODENAME&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo curl -fsSL &lt;span class="s2">&amp;#34;https://pkgs.tailscale.com/stable/ubuntu/&lt;/span>&lt;span class="nv">$codename&lt;/span>&lt;span class="s2">.noarmor.gpg&amp;#34;&lt;/span> -o /etc/apt/keyrings/tailscale.gpg
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo chmod a+r /etc/apt/keyrings/tailscale.gpg
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo tee /etc/apt/sources.list.d/tailscale.sources &amp;gt;/dev/null &lt;span class="s">&amp;lt;&amp;lt;EOF
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Types: deb
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">URIs: https://pkgs.tailscale.com/stable/ubuntu
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Suites: $codename
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Components: main
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Signed-By: /etc/apt/keyrings/tailscale.gpg
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt update
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt install --no-install-recommends tailscale -y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo tailscale up --hostname&lt;span class="o">=&lt;/span>dell-wyse --advertise-tags&lt;span class="o">=&lt;/span>tag:server --accept-dns&lt;span class="o">=&lt;/span>&lt;span class="nb">false&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo tailscale &lt;span class="nb">set&lt;/span> --auto-update
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tailscale status
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 100.96.85.107 dell-wyse dell-wyse.tailnet-name.ts.net linux -&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>&lt;strong>&lt;code>--advertise-tags=tag:server&lt;/code>&lt;/strong> makes the host a tagged node: no key expiry, and not tied to your account.&lt;/li>
&lt;li>&lt;strong>&lt;code>--accept-dns=false&lt;/code>&lt;/strong> keeps the host on the FRITZ!Box&amp;rsquo;s DNS, so name resolution on the host and in its containers stays as it is, including AIO&amp;rsquo;s domain check in &lt;a href="#932-path-a-set-up-nextcloud-aio">section 9.3.2&lt;/a>.
With Serve instead of Funnel, the host needs &lt;code>--accept-dns=true&lt;/code> instead; see the note &lt;strong>Serve instead of Funnel&lt;/strong> in &lt;a href="#92-configure-the-deployment-on-the-wyse">section 9.2&lt;/a>.
That setting persists, but running the &lt;code>tailscale up&lt;/code> line above again as printed turns it off, so with Serve leave &lt;code>--accept-dns=false&lt;/code> out of it.&lt;/li>
&lt;li>&lt;strong>&lt;code>--auto-update&lt;/code>&lt;/strong> lets Tailscale keep its own package current; Ubuntu&amp;rsquo;s automatic updates do not cover its repository.&lt;/li>
&lt;li>&lt;strong>SSH&lt;/strong> stays with OpenSSH, your keys and the hardening from &lt;a href="#5-update-and-harden-the-ubuntu-host">section 5&lt;/a>; Tailscale SSH is not enabled.&lt;/li>
&lt;/ul>
&lt;div class="alert alert-note">
&lt;div>
&lt;strong>UFW needs no rule for this.&lt;/strong>
Tailscale filters tailnet traffic against the policy itself, then accepts what passes on &lt;code>tailscale0&lt;/code> before UFW sees it.
It also opens its own WireGuard port, 41641/udp, which stays silent without a valid key.
So the tailnet policy, with the grants from &lt;a href="#81-tailscale-admin-console">section 8.1&lt;/a>, step 3, is the firewall for the tailnet.
&lt;/div>
&lt;/div>
&lt;p>Test it from the &lt;strong>Mac&lt;/strong>, at home or away; the host key&amp;rsquo;s fingerprint is the one from &lt;a href="#55-key-only-ssh-verified-before-password-login-is-disabled">section 5.5&lt;/a>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">ssh wmutschl@dell-wyse
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ssh wmutschl@100.96.85.107
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="9-nextcloud">9 Nextcloud&lt;/h2>
&lt;h3 id="91-plan-the-tailscale-node-name-for-nextcloud">9.1 Plan the Tailscale node name for Nextcloud&lt;/h3>
&lt;p>The sidecar&amp;rsquo;s MagicDNS name is the domain that Nextcloud AIO is set up with, and it also names the certificate that Tailscale issues.
If a node with the same name already exists in the admin console, even offline, Tailscale gives the new node a suffixed name such as &lt;code>nextcloud-1&lt;/code>.
The suffix stays when the other node is renamed later.
So free the name &lt;strong>before&lt;/strong> the new sidecar first starts, or fix it afterwards with &lt;strong>Edit machine name&lt;/strong>; see &lt;a href="https://tailscale.com/docs/concepts/machine-names" target="_blank" rel="noopener">Machine names&lt;/a>.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Situation&lt;/th>
&lt;th>&lt;code>TAILSCALE_HOSTNAME&lt;/code> in &lt;code>.env&lt;/code>&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Path A, new name&lt;/td>
&lt;td>Any name that no node in the admin console uses, for example &lt;code>nextcloud&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Path A, replacing another instance&lt;/td>
&lt;td>&lt;code>nextcloud&lt;/code>, after the other node has been renamed (&lt;a href="#943-path-b-hand-over-the-tailscale-name">section 9.4.3&lt;/a>)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Path B, restore&lt;/td>
&lt;td>Exactly the domain inside the backup, &lt;code>nextcloud&lt;/code>, after the handover in &lt;a href="#943-path-b-hand-over-the-tailscale-name">section 9.4.3&lt;/a>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h3 id="92-configure-the-deployment-on-the-wyse">9.2 Configure the deployment on the Wyse&lt;/h3>
&lt;p>The repository was cloned to &lt;code>~/scripts&lt;/code> in &lt;a href="#53-the-scripts-repository">section 5.3&lt;/a>.
On the Wyse, bring it up to date and create &lt;code>.env&lt;/code> from the template:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">git pull
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cp dell-wyse.env .env
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">chmod &lt;span class="m">600&lt;/span> .env
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">nano .env
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Fill in &lt;code>TAILSCALE_OAUTH_KEY&lt;/code> and set &lt;code>TAILSCALE_HOSTNAME&lt;/code> according to the table in &lt;a href="#91-plan-the-tailscale-node-name-for-nextcloud">section 9.1&lt;/a>.
&lt;code>TAILSCALE_SERVE_CONFIG=nextcloud-funnel.json&lt;/code> keeps this guide&amp;rsquo;s Funnel setup; the note below covers the tailnet-only alternative.
Keep &lt;code>NEXTCLOUD_DATADIR=/srv/nextcloud/data&lt;/code>: it must be set before AIO starts for the first time, and must never change afterwards.
Git ignores &lt;code>.env&lt;/code>.&lt;/p>
&lt;p>Review the two files that the stack uses (press &lt;code>q&lt;/code> to quit &lt;code>less&lt;/code>):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">less docker-compose.yml
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">less ../Tailscale/nextcloud-funnel.json
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>What they configure:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Sidecar:&lt;/strong> containerboot logs in with the OAuth secret only if the node has no saved state (&lt;code>TS_AUTH_ONCE=true&lt;/code>); otherwise it would mint a new single-use key on every restart.
It advertises &lt;code>tag:nextcloud&lt;/code>, disables the upload of client logs (&lt;code>TS_NO_LOGS_NO_SUPPORT=true&lt;/code>) and runs in userspace mode without extra privileges.
It loads the file named in &lt;code>TAILSCALE_SERVE_CONFIG&lt;/code>, &lt;code>nextcloud-funnel.json&lt;/code> by default, with &lt;code>${TS_CERT_DOMAIN}&lt;/code> replaced by the node&amp;rsquo;s own name, and re-applies it whenever it changes.&lt;/li>
&lt;li>&lt;strong>Serve/Funnel:&lt;/strong> 443 proxies to &lt;code>http://nextcloud-aio-apache:11000&lt;/code> and is public through Funnel (&lt;code>AllowFunnel&lt;/code> true).
8080 proxies to the mastercontainer and is tailnet-only (&lt;code>AllowFunnel&lt;/code> false).
Funnel only ever serves the ports 443, 8443 and 10000, so 8080 cannot become public by accident.&lt;/li>
&lt;li>&lt;strong>Mastercontainer:&lt;/strong> joins the pre-created &lt;code>nextcloud-aio&lt;/code> network, as upstream&amp;rsquo;s compose file allows for custom network settings.
AIO puts its own containers on the same network, which is how the sidecar resolves &lt;code>nextcloud-aio-apache&lt;/code>.
AIO also trusts that network&amp;rsquo;s subnet as a proxy by itself.
&lt;code>APACHE_IP_BINDING=&amp;quot;@INTERNAL&amp;quot;&lt;/code> publishes no Apache port on the host; AIO&amp;rsquo;s own Caddy community container uses the same value.
The mastercontainer&amp;rsquo;s only published port, 8080 for the break-glass tunnel (&lt;a href="#96-later-logins-to-the-aio-interface">section 9.6&lt;/a>), is bound to &lt;code>127.0.0.1&lt;/code>.
The network itself sets &lt;code>com.docker.network.bridge.host_binding_ipv4=127.0.0.1&lt;/code>, so any port that AIO publishes without an explicit address lands on loopback as well; that only concerns Talk (&lt;a href="#56-firewall-and-service-exposure">section 5.6&lt;/a>).
During setup, AIO&amp;rsquo;s temporary domaincheck container carries the &lt;code>nextcloud-aio-apache&lt;/code> alias, so the sidecar reaches it too.&lt;/li>
&lt;li>&lt;strong>Limits:&lt;/strong> &lt;code>NEXTCLOUD_MEMORY_LIMIT=2048M&lt;/code> and &lt;code>NEXTCLOUD_UPLOAD_LIMIT=32G&lt;/code>.
AIO accepts only these formats: megabytes for memory, gigabytes for uploads.&lt;/li>
&lt;li>&lt;strong>Project name:&lt;/strong> &lt;code>dell-wyse&lt;/code>.
Keep it different from &lt;code>nextcloud-aio&lt;/code>, the compose project label that AIO puts on its own containers, so that those never look like orphans of this project.&lt;/li>
&lt;/ul>
&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Serve instead of Funnel.&lt;/strong>
To keep Nextcloud reachable only from devices in your tailnet, set &lt;code>TAILSCALE_SERVE_CONFIG=nextcloud-serve.json&lt;/code> in &lt;code>.env&lt;/code>; that file is &lt;code>nextcloud-funnel.json&lt;/code> without &lt;code>AllowFunnel&lt;/code>.
On a stack that already runs, do the policy and DNS steps below first and run the check below while Funnel is still on; then &lt;code>sudo docker compose up -d nextcloud-tailscale&lt;/code> applies the file, and the sidecar keeps its tailnet identity.
Also drop the &lt;code>funnel&lt;/code> attribute for &lt;code>tag:nextcloud&lt;/code> from the policy (&lt;a href="#81-tailscale-admin-console">section 8.1&lt;/a>, step 2): Serve does not need it, and without it Tailscale cannot publish Nextcloud even if the sidecar is started with &lt;code>nextcloud-funnel.json&lt;/code> again.&lt;/p>
&lt;p>AIO&amp;rsquo;s own containers still have to reach Nextcloud under its name, which only Funnel puts into public DNS, so let the host resolve tailnet names: &lt;code>sudo tailscale set --accept-dns=true&lt;/code>, instead of &lt;code>--accept-dns=false&lt;/code> from &lt;a href="#82-on-the-wyse">section 8.2&lt;/a>.
Docker forwards the containers&amp;rsquo; lookups to the host&amp;rsquo;s systemd-resolved, which then sends tailnet names to Tailscale&amp;rsquo;s resolver and everything else to the FRITZ!Box.
&lt;code>resolvectl status tailscale0&lt;/code> then lists &lt;code>100.100.100.100&lt;/code> under &lt;code>DNS Servers&lt;/code>, your tailnet&amp;rsquo;s name and reverse zones under &lt;code>DNS Domain&lt;/code>, and &lt;code>-DefaultRoute&lt;/code>.
If &lt;code>DNS Domain&lt;/code> shows &lt;code>~.&lt;/code> instead, &lt;strong>Override DNS servers&lt;/strong> is on in the admin console&amp;rsquo;s DNS settings, and the host&amp;rsquo;s other lookups go to the tailnet&amp;rsquo;s global nameservers instead of the FRITZ!Box.
The containers then reach the sidecar through the host&amp;rsquo;s own tailnet connection, as &lt;code>tag:server&lt;/code>, so with the grants from &lt;a href="#81-tailscale-admin-console">section 8.1&lt;/a>, step 3, also allow &lt;code>tag:server&lt;/code> to reach &lt;code>tag:nextcloud&lt;/code> on &lt;code>tcp:443&lt;/code>.
While the host&amp;rsquo;s Tailscale restarts, for example during its automatic update, these calls fail for those seconds.
If the containers cannot resolve and reach the name this way, Euro-Office cannot open or save documents, desktop clients lose &lt;strong>Client Push&lt;/strong> and poll instead, &lt;strong>Administration settings → Overview&lt;/strong> warns that the server cannot connect to itself, and Talk&amp;rsquo;s signaling server and Whiteboard&amp;rsquo;s recordings fail.
Once AIO&amp;rsquo;s containers run, each of them must reach Nextcloud through the sidecar&amp;rsquo;s tailnet address, &lt;code>100.x&lt;/code>, with &lt;code>200&lt;/code>; leave out &lt;code>nextcloud-aio-eurooffice&lt;/code> without Euro-Office:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="k">for&lt;/span> c in nextcloud-aio-nextcloud nextcloud-aio-eurooffice nextcloud-aio-mastercontainer&lt;span class="p">;&lt;/span> &lt;span class="k">do&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> sudo docker &lt;span class="nb">exec&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$c&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> curl -sS -m &lt;span class="m">10&lt;/span> -o /dev/null -w &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$c&lt;/span>&lt;span class="s2"> %{remote_ip} %{http_code}\n&amp;#34;&lt;/span> https://nextcloud.tailnet-name.ts.net/status.php
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">done&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>serve status&lt;/code> lists both URLs as &lt;code>(tailnet only)&lt;/code>; skip the Funnel checks in sections &lt;a href="#931-path-a-start-the-stack-and-check-the-node-name">9.3.1&lt;/a>, &lt;a href="#932-path-a-set-up-nextcloud-aio">9.3.2&lt;/a> and &lt;a href="#943-path-b-hand-over-the-tailscale-name">9.4.3&lt;/a>.
With the host resolving the name, AIO&amp;rsquo;s domain check in &lt;a href="#932-path-a-set-up-nextcloud-aio">section 9.3.2&lt;/a> should pass; if it does not, skip it as described there.
Every device that uses Nextcloud, including those of other users, needs the Tailscale app, connected and with Tailscale DNS on.
Under the default allow-all policy, other users&amp;rsquo; devices can then reach every device in your tailnet, including the AIO interface and SSH on the host, so narrow the policy as in &lt;a href="#81-tailscale-admin-console">section 8.1&lt;/a>, step 3.
Public share links and federated sharing reach no one outside the tailnet.&lt;/p>
&lt;p>Nextcloud treats tailnet addresses as local and refuses its own requests to them unless the feature opts in, which Euro-Office, Client Push and the setup checks do; AIO removes the global &lt;code>allow_local_remote_servers&lt;/code> at every start.
Subscribing to a public calendar link of the same instance needs &lt;code>sudo docker exec --user www-data nextcloud-aio-nextcloud php occ config:app:set dav webcalAllowLocalAccess --value=yes&lt;/code>; other refusals show up as &lt;code>violates local access rules&lt;/code> in the log.
Nextcloud blocks this by default for security reasons: the setting lets every user&amp;rsquo;s calendar subscriptions reach any LAN, tailnet or container address, so set it only if such a subscription is needed.
When an instance switches from Funnel, public resolvers can list Funnel&amp;rsquo;s addresses for hours, but the route behind them closes at once.&lt;/p>
&lt;/div>
&lt;/div>
&lt;p>Validate the compose file and pre-pull the images.&lt;/p>
&lt;div class="alert alert-warning">
&lt;div>
&lt;strong>Do not start the stack yet.&lt;/strong>
Starting it registers the Tailscale node, and the name it gets depends on the path you follow next.
&lt;/div>
&lt;/div>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker compose config --quiet
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker compose pull
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Always run compose from &lt;code>~/scripts/Dell-Wyse-Thin-Client-5070&lt;/code>, so that &lt;code>.env&lt;/code> and &lt;code>../Tailscale&lt;/code> resolve.
Never run &lt;code>docker compose down&lt;/code> for this project: it would try to remove the &lt;code>nextcloud-aio&lt;/code> network while AIO&amp;rsquo;s own containers are still attached; use &lt;code>stop&lt;/code> and &lt;code>up -d&lt;/code> instead.&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
&lt;strong>Only the mastercontainer and the sidecar belong to this project.&lt;/strong>
Stop and start Nextcloud itself through the AIO interface.
&lt;/div>
&lt;/div>
&lt;p>The socket mount&amp;rsquo;s &lt;code>:ro&lt;/code> option does &lt;strong>not&lt;/strong> make Docker API operations read-only, so treat access to the AIO interface as administrator access to the host; see &lt;a href="https://github.com/nextcloud/all-in-one/blob/main/compose.yaml" target="_blank" rel="noopener">upstream&amp;rsquo;s compose file&lt;/a> and &lt;a href="https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md" target="_blank" rel="noopener">AIO behind a reverse proxy&lt;/a>.&lt;/p>
&lt;h3 id="93-path-a-fresh-nextcloud-install">9.3 Path A: fresh Nextcloud install&lt;/h3>
&lt;h4 id="931-path-a-start-the-stack-and-check-the-node-name">9.3.1 Path A: Start the stack and check the node name&lt;/h4>
&lt;p>Confirm that the name in &lt;code>.env&lt;/code> is free in the admin console.
If you are reusing &lt;code>nextcloud&lt;/code>, first stop the other instance and rename its node as described in sections &lt;a href="#941-path-b-freeze-the-source-moving-from-the-previous-instance">9.4.1&lt;/a> and &lt;a href="#943-path-b-hand-over-the-tailscale-name">9.4.3&lt;/a>.
Then, on the &lt;strong>Wyse&lt;/strong>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker compose up -d
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker compose logs --tail &lt;span class="m">50&lt;/span> nextcloud-tailscale
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> nextcloud-tailscale tailscale status --json &lt;span class="p">|&lt;/span> python3 -c &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s1">&amp;#39;import json,sys; print(json.load(sys.stdin)[&amp;#34;Self&amp;#34;][&amp;#34;DNSName&amp;#34;].rstrip(&amp;#34;.&amp;#34;))&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> nextcloud-tailscale tailscale serve status
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># # Funnel on:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># # - https://nextcloud.tailnet-name.ts.net&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># https://nextcloud.tailnet-name.ts.net (Funnel on)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-- / proxy http://nextcloud-aio-apache:11000&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># https://nextcloud.tailnet-name.ts.net:8080 (tailnet only)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># |-- / proxy https+insecure://nextcloud-aio-mastercontainer:8080&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Proceed only if the printed name is exactly the one you planned, for example &lt;code>nextcloud.tailnet-name.ts.net&lt;/code>.
If it carries a suffix, rename the node in the admin console, then restart the sidecar so that its serve configuration picks up the new name:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo docker compose restart nextcloud-tailscale
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>serve status&lt;/code> should list the name with Funnel on for 443 and tailnet-only for 8080.
A backend error on 443 is expected until AIO&amp;rsquo;s Apache container runs.&lt;/p>
&lt;p>&amp;ldquo;Funnel on&amp;rdquo; alone is not proof.
Without the &lt;code>funnel&lt;/code> node attribute from &lt;a href="#81-tailscale-admin-console">section 8.1&lt;/a>, the serve file is still accepted and reported as Funnel on, but Tailscale creates no public DNS record.
Check the attribute on the &lt;strong>Wyse&lt;/strong>; it should print &lt;code>True&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> nextcloud-tailscale tailscale status --json &lt;span class="p">|&lt;/span> python3 -c &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s1">&amp;#39;import json,sys; s=json.load(sys.stdin)[&amp;#34;Self&amp;#34;]; print(any(&amp;#34;funnel&amp;#34; in c for c in list(s.get(&amp;#34;Capabilities&amp;#34;) or []) + list(s.get(&amp;#34;CapMap&amp;#34;) or {})))&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># True&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then check the public DNS from another machine, such as the Mac, through a public resolver rather than MagicDNS:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">dig @1.1.1.1 +short nextcloud.tailnet-name.ts.net
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 185.40.234.37&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 185.40.234.172&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 185.40.234.210&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>These should be addresses outside &lt;code>100.x&lt;/code>, but the record can take up to ten minutes to appear.&lt;/p>
&lt;h4 id="932-path-a-set-up-nextcloud-aio">9.3.2 Path A: Set up Nextcloud AIO&lt;/h4>
&lt;ol>
&lt;li>
&lt;p>On a &lt;strong>tailnet device&lt;/strong>, open &lt;code>https://nextcloud.tailnet-name.ts.net:8080&lt;/code>, with your planned name.
The certificate is Tailscale&amp;rsquo;s, so there is no browser warning.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Copy the generated &lt;strong>AIO passphrase&lt;/strong> into your password manager and log in.
The AIO passphrase, the Nextcloud administrator password and the Borg backup password are three different credentials.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Enter the domain &lt;strong>without a port&lt;/strong>: &lt;code>nextcloud.tailnet-name.ts.net&lt;/code>.
AIO validates it from inside the mastercontainer.
With Funnel, the host does not use MagicDNS (&lt;code>--accept-dns=false&lt;/code>, &lt;a href="#82-on-the-wyse">section 8.2&lt;/a>), so the name resolves to Funnel&amp;rsquo;s public addresses, and Funnel carries the check back through the sidecar to AIO&amp;rsquo;s domaincheck container.
On my Wyse, the validation failed nonetheless, so expect to skip it, but only after confirming the public route yourself:&lt;/p>
&lt;ul>
&lt;li>
&lt;p>From a phone with Tailscale disabled, &lt;code>https://nextcloud.tailnet-name.ts.net&lt;/code> answers with a valid certificate.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>On the Wyse, &lt;code>sudo docker exec nextcloud-tailscale tailscale serve status&lt;/code> shows Funnel on for 443.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>From the Mac, the name resolves to a public address that serves Tailscale&amp;rsquo;s certificate for it:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="nv">name&lt;/span>&lt;span class="o">=&lt;/span>nextcloud.tailnet-name.ts.net
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">ip&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>dig @1.1.1.1 +short &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$name&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="p">|&lt;/span> grep -v &lt;span class="s1">&amp;#39;:&amp;#39;&lt;/span> &lt;span class="p">|&lt;/span> head -1&lt;span class="k">)&lt;/span>&lt;span class="p">;&lt;/span> &lt;span class="nb">echo&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$ip&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">curl -sv --resolve &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$name&lt;/span>&lt;span class="s2">:443:&lt;/span>&lt;span class="nv">$ip&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;https://&lt;/span>&lt;span class="nv">$name&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> -o /dev/null 2&amp;gt;&lt;span class="p">&amp;amp;&lt;/span>&lt;span class="m">1&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="p">|&lt;/span> grep -E &lt;span class="s1">&amp;#39;subject:|issuer:|SSL certificate verify|&amp;lt; HTTP&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 185.40.234.37&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># * subject: CN=nextcloud.tailnet-name.ts.net&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># * issuer: C=US; O=Let&amp;#39;s Encrypt; CN=YE1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># * SSL certificate verify ok.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># &amp;lt; HTTP/2 302 &lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ul>
&lt;p>Only then reload the interface as &lt;code>https://nextcloud.tailnet-name.ts.net:8080/containers?skip_domain_validation&lt;/code> and enter the domain again.
That skips the check without changing the compose file; recent AIO versions keep the flag for the rest of the browser session and show it in a yellow bar.
Without the check, AIO does not catch a typo, so compare the domain character by character; see &lt;a href="https://github.com/nextcloud/all-in-one#how-to-skip-the-domain-validation" target="_blank" rel="noopener">AIO domain validation&lt;/a>.
With Serve instead of Funnel, the check goes through the host&amp;rsquo;s MagicDNS (note &lt;strong>Serve instead of Funnel&lt;/strong> in &lt;a href="#92-configure-the-deployment-on-the-wyse">section 9.2&lt;/a>), and the Funnel checks above do not apply.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Choose the optional containers.
For a fresh, lightly used instance on the J4105, start with &lt;strong>Talk, ClamAV, Whiteboard and the community containers disabled&lt;/strong> unless you need them.
Keep one office service if occasional editing in the browser is useful, and enable Imaginary only for previews you actually want.
The CPU, rather than the RAM, is the main reason to avoid unnecessary indexing and preview work.
Optional containers can be added later through AIO.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Set the time zone to &lt;code>Europe/Berlin&lt;/code> and click &lt;strong>Download and start containers&lt;/strong>.
The first start downloads several images and initializes PostgreSQL and Nextcloud; allow 10–20 minutes on this CPU.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>When AIO reports all containers as running, it shows the initial administrator name and password.
Store them, then open &lt;code>https://nextcloud.tailnet-name.ts.net&lt;/code> or click the blue button &lt;strong>Open your Nextcloud&lt;/strong>.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;h4 id="933-path-a-first-steps-in-the-new-nextcloud">9.3.3 Path A: First steps in the new Nextcloud&lt;/h4>
&lt;ol>
&lt;li>Enable multi-factor authentication (TOTP) for the administrator and store its recovery codes.&lt;/li>
&lt;li>Create the user accounts.
Use them for daily sync, not the administrator account.&lt;/li>
&lt;li>Set up the AIO backup to &lt;code>/mnt/backup&lt;/code> and create the first backup before putting data in; then enable daily backups at 03:00 UTC (&lt;a href="#101-aio-borg-backup-to-hdd-2">section 10.1&lt;/a>).
Then start the off-site mirror (&lt;a href="#76-off-site-mirror-on-a-hetzner-storage-box">section 7.6&lt;/a>, step 6).&lt;/li>
&lt;li>Run the post-installation tasks in &lt;a href="#95-after-either-path-nextcloud-configuration">section 9.5&lt;/a>.&lt;/li>
&lt;/ol>
&lt;div class="alert alert-note">
&lt;div>
&lt;strong>Reconnect every client from scratch.&lt;/strong>
Treat every client as a &lt;strong>new sync relationship&lt;/strong>, even if the URL is unchanged.
&lt;/div>
&lt;/div>
&lt;h3 id="94-path-b-reinstall-from-an-aio-backup">9.4 Path B: reinstall from an AIO backup&lt;/h3>
&lt;p>This restores the complete previous instance: accounts, shares, public links, calendars, contacts, file versions, app data and the AIO configuration, including its domain and optional containers.
Use it to move a previous instance to the Wyse, and to rebuild the Wyse later.
Section 7.2 has already prepared the HDDs by what was on them: disks with this guide&amp;rsquo;s backups were reused in &lt;a href="#722-rebuilding-the-wyse-reuse-the-hdds">section 7.2.2&lt;/a>, and only disks with nothing you still needed were erased in &lt;a href="#721-new-hdds-partition-and-encrypt">section 7.2.1&lt;/a>.
Do not run section 7.2.1 again here.
If the Borg repository itself were damaged, the daily copies on HDD 1 still contain every user&amp;rsquo;s files under &lt;code>@nextcloud.&amp;lt;timestamp&amp;gt;/data&lt;/code>.&lt;/p>
&lt;p>You need:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="#7-backup-disks-snapshots-alerts-and-the-home-assistant-share">Section 7&lt;/a> done: both HDDs mounted, BTRBK timers running, alerts working, the HA share in place.&lt;/li>
&lt;li>A complete, recent AIO Borg repository, the whole &lt;code>borg&lt;/code> directory rather than a single archive, and its &lt;strong>Borg password&lt;/strong>.&lt;/li>
&lt;li>A way for the Wyse to read it: HDD 2 from &lt;a href="#72-prepare-the-two-hdds">section 7.2&lt;/a> (see &lt;a href="#942-path-b-make-the-borg-repository-readable-on-the-wyse">9.4.2&lt;/a>), or a remote Borg repository reachable over SSH.
If HDD 2 is lost too, copy the off-site mirror back from the Storage Box first (&lt;a href="#77-restore-from-the-storage-box">section 7.7&lt;/a>).&lt;/li>
&lt;li>Sections &lt;a href="#8-prepare-tailscale-for-the-host-and-the-sidecar">8&lt;/a>, &lt;a href="#91-plan-the-tailscale-node-name-for-nextcloud">9.1&lt;/a> and &lt;a href="#92-configure-the-deployment-on-the-wyse">9.2&lt;/a> done: &lt;code>~/scripts/Dell-Wyse-Thin-Client-5070/.env&lt;/code> filled in with &lt;code>TAILSCALE_HOSTNAME=nextcloud&lt;/code>, images pulled, stack &lt;strong>not&lt;/strong> started.&lt;/li>
&lt;/ul>
&lt;h4 id="941-path-b-freeze-the-source-moving-from-the-previous-instance">9.4.1 Path B: Freeze the source (moving from the previous instance)&lt;/h4>
&lt;ol>
&lt;li>
&lt;p>In the previous instance&amp;rsquo;s AIO interface, update AIO and its containers, confirm that Nextcloud works, and create an initial backup.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>In the maintenance window, let all users finish syncing, then pause their clients.
Stop the containers through the AIO interface and create the &lt;strong>final&lt;/strong> backup.
Confirm that AIO reports it as successful.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Keep the old endpoint from coming back.
On the previous machine, stop the sidecar and the mastercontainer by their container names, which works regardless of where its compose file lives:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">docker update --restart&lt;span class="o">=&lt;/span>no nextcloud-tailscale nextcloud-aio-mastercontainer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">docker stop nextcloud-tailscale nextcloud-aio-mastercontainer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">docker ps --filter &lt;span class="nv">name&lt;/span>&lt;span class="o">=&lt;/span>nextcloud
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The last command must list no running Nextcloud container.
Keep the previous instance&amp;rsquo;s Docker volumes and its data directory (&lt;code>/Volumes/Docker/nextcloud&lt;/code> on my Mac) untouched: they are your rollback.
Do not run &lt;code>docker compose down -v&lt;/code> or any prune there.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;h4 id="942-path-b-make-the-borg-repository-readable-on-the-wyse">9.4.2 Path B: Make the Borg repository readable on the Wyse&lt;/h4>
&lt;p>The repository goes onto HDD 2 (&lt;code>/mnt/backup&lt;/code>, &lt;a href="#72-prepare-the-two-hdds">section 7.2&lt;/a>) and stays there as the Wyse&amp;rsquo;s ongoing AIO backup repository; later backups continue in it with deduplication.
Do not restore from a repository on the Vi560 itself: the repository and the restored data together would leave too little free space, and it would not be independent storage.&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
&lt;strong>Rebuilding the Wyse.&lt;/strong>
When rebuilding the Wyse, HDD 2 already holds the repository and has been mounted at &lt;code>/mnt/backup&lt;/code> since &lt;a href="#723-unlock-and-mount-the-hdds-at-boot">section 7.2.3&lt;/a>.
Check that with &lt;code>findmnt /mnt/backup&lt;/code> and &lt;code>sudo ls /mnt/backup/borg&lt;/code>, then continue with &lt;a href="#943-path-b-hand-over-the-tailscale-name">section 9.4.3&lt;/a>.
&lt;/div>
&lt;/div>
&lt;p>To transfer the Mac&amp;rsquo;s repository, wait until the final backup has finished and nothing else runs on the repository.
Check that HDD 2 has room for it with &lt;code>df -h /mnt/backup&lt;/code>.
Then, on the &lt;strong>Wyse&lt;/strong>, give your account a target directory:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo install -d -m &lt;span class="m">0700&lt;/span> -o &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$USER&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> -g &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$USER&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> /mnt/backup/borg
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>On the &lt;strong>Mac&lt;/strong>, copy the repository, then compare checksums.
Replace the source with the old machine&amp;rsquo;s actual AIO backup directory, which contains &lt;code>borg&lt;/code>, and adjust the login:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">/usr/bin/rsync -rt --partial --progress --stats -e ssh &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s1">&amp;#39;/PATH/TO/MAC/AIO-BACKUP/borg/&amp;#39;&lt;/span> &lt;span class="s1">&amp;#39;wmutschl@192.168.178.55:/mnt/backup/borg/&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">/usr/bin/rsync -rtc --dry-run --itemize-changes --stats -e ssh &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s1">&amp;#39;/PATH/TO/MAC/AIO-BACKUP/borg/&amp;#39;&lt;/span> &lt;span class="s1">&amp;#39;wmutschl@192.168.178.55:/mnt/backup/borg/&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The checksum pass must report no transferred files.
Where AIO asks for the backup location, enter the &lt;strong>parent&lt;/strong> directory, &lt;code>/mnt/backup&lt;/code>.
For a remote Borg repository, have its SSH URL ready instead.
See &lt;a href="https://github.com/nextcloud/all-in-one#how-to-migrate-from-aio-to-aio" target="_blank" rel="noopener">AIO-to-AIO migration&lt;/a> and &lt;a href="https://github.com/nextcloud/all-in-one#are-remote-borg-backups-supported" target="_blank" rel="noopener">remote Borg backups&lt;/a> for details.&lt;/p>
&lt;h4 id="943-path-b-hand-over-the-tailscale-name">9.4.3 Path B: Hand over the Tailscale name&lt;/h4>
&lt;ol>
&lt;li>
&lt;p>In the Tailscale admin console, open the old node that holds &lt;code>nextcloud&lt;/code> and rename it to an unused name.
For the sidecar of the previous instance, I use &lt;code>nextcloud-mac-retired&lt;/code> and keep the node for a rollback.
When rebuilding the Wyse, the old node&amp;rsquo;s state is gone with the reinstallation, so delete it instead.
Do not rename the tailnet or touch unrelated nodes.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>On the &lt;strong>Wyse&lt;/strong>, start the stack and check the name, exactly as in Path A:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker compose up -d
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> nextcloud-tailscale tailscale status --json &lt;span class="p">|&lt;/span> python3 -c &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s1">&amp;#39;import json,sys; print(json.load(sys.stdin)[&amp;#34;Self&amp;#34;][&amp;#34;DNSName&amp;#34;].rstrip(&amp;#34;.&amp;#34;))&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> nextcloud-tailscale tailscale serve status
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Proceed only if the output is &lt;code>nextcloud.tailnet-name.ts.net&lt;/code>.
Otherwise, fix the name in the admin console and restart the sidecar.
Run the two Funnel checks from Path A (&lt;a href="#931-path-a-start-the-stack-and-check-the-node-name">section 9.3.1&lt;/a>) as well: the restore skips the domain validation, so nothing else would notice a missing public route.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>Reusing the name does not preserve the old node&amp;rsquo;s Tailscale IP address or identity; adjust any node-specific policy entries.
The Wyse&amp;rsquo;s node carries &lt;code>tag:nextcloud&lt;/code>, and the retired node keeps &lt;code>tag:container&lt;/code>.
Never copy the retired sidecar&amp;rsquo;s state volume to the Wyse while the retired node still exists.&lt;/p>
&lt;h4 id="944-path-b-restore-in-aio">9.4.4 Path B: Restore in AIO&lt;/h4>
&lt;ol>
&lt;li>On a &lt;strong>tailnet device&lt;/strong>, open &lt;code>https://nextcloud.tailnet-name.ts.net:8080&lt;/code>.
Save the new AIO passphrase and log in.
The restore keeps this new passphrase; the old one is not restored.&lt;/li>
&lt;li>Choose &lt;strong>Restore former AIO instance from backup&lt;/strong>.
Do not set up a new instance first.&lt;/li>
&lt;li>Enter the backup location and the &lt;strong>old&lt;/strong> Borg password, then submit.
For a local repository, enter the parent of &lt;code>borg&lt;/code>, starting with &lt;code>/&lt;/code> and without a trailing slash: &lt;code>/mnt/backup&lt;/code>.
For a remote repository, leave the local field empty and enter &lt;code>ssh://user@host:port/path/to/repo&lt;/code>.
Then click &lt;strong>Test path and encryption password&lt;/strong>.
Once the test succeeds, AIO lists the archives.
With a remote repository, the first test fails and AIO shows an SSH public key: authorize it on the remote side, submit the location again and repeat the test.&lt;/li>
&lt;li>Optionally, run &lt;strong>Check backup integrity&lt;/strong> (&lt;code>borg check --verify-data&lt;/code>); it reads the whole repository and takes long on a USB disk.
Select the final archive and click &lt;strong>Restore selected backup&lt;/strong>.
&lt;strong>Exclude previews from restore&lt;/strong> saves time and space; AIO then rescans the preview folder by itself the next time the Nextcloud container starts, and Nextcloud regenerates previews on demand.
For about 860 GiB, allow several hours.
If the source used community containers, AIO asks for the same backup to be restored a second time.&lt;/li>
&lt;li>When the restore finishes, start the containers from the AIO interface you are using, so that AIO records this URL as its administration address.&lt;/li>
&lt;li>Check the restored instance: every user&amp;rsquo;s files, shares and public links, calendars and contacts, file versions, and office editing if enabled.
Download sample files and compare their hashes with the source.&lt;/li>
&lt;li>Check the backup settings in AIO.
The restored instance keeps the location you just restored from; make sure that is &lt;code>/mnt/backup&lt;/code> on HDD 2 (or your remote repository).
Set daily backups at 03:00 UTC (&lt;a href="#101-aio-borg-backup-to-hdd-2">section 10.1&lt;/a>) and create a new backup.
Then start the off-site mirror (&lt;a href="#76-off-site-mirror-on-a-hetzner-storage-box">section 7.6&lt;/a>, step 6), or, once &lt;code>/srv/ha-backups&lt;/code> holds HA&amp;rsquo;s backups again, enable its timer again if you disabled it for the restore (&lt;a href="#77-restore-from-the-storage-box">section 7.7&lt;/a>).&lt;/li>
&lt;li>Keep the source&amp;rsquo;s optional containers for this first test.
Simplify only after acceptance, through AIO.&lt;/li>
&lt;/ol>
&lt;h4 id="945-path-b-reopen">9.4.5 Path B: Reopen&lt;/h4>
&lt;p>Unpause one desktop client first and watch it reconcile, then the phones and the other users.
The restored instance has the same URL, file IDs and sync state, so the clients continue rather than starting a new sync relationship.
Keep the old instance&amp;rsquo;s data, volumes and retired Tailscale node until the restored instance has passed the checks in &lt;a href="#944-path-b-restore-in-aio">section 9.4.4&lt;/a>, step 6.&lt;/p>
&lt;h3 id="95-after-either-path-nextcloud-configuration">9.5 After either path: Nextcloud configuration&lt;/h3>
&lt;p>Review &lt;strong>Administration settings → Overview&lt;/strong> and fix what it reports.
Then go through these settings:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Administrator&amp;rsquo;s email address:&lt;/strong> set up personal details and an email address for the administrator account under &lt;strong>Personal settings → Personal info&lt;/strong>, so that the test mail below has a recipient.&lt;/li>
&lt;li>&lt;strong>Security:&lt;/strong> under &lt;strong>Administration settings → Security&lt;/strong>, consider enforcing two-factor authentication for all users.
Under &lt;strong>Administration settings → Sharing&lt;/strong>, decide whether public links require a password and an expiration date.
Leave Nextcloud&amp;rsquo;s built-in brute-force protection enabled.&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Email server.&lt;/strong> Nextcloud sends password resets, share notifications and activity mails through an SMTP server.
I use an otherwise inactive Gmail account, authenticated with an app password rather than the Google account&amp;rsquo;s password.
Google offers app passwords only for accounts with 2-Step Verification; create one at &lt;a href="https://myaccount.google.com/apppasswords" target="_blank" rel="noopener">myaccount.google.com/apppasswords&lt;/a>.
Nextcloud keeps it in plain text in &lt;code>config.php&lt;/code>, and so in every Borg backup, but an app password can be revoked on its own without touching the Google account.
Then open &lt;strong>Administration settings → Basic settings → Email server&lt;/strong> and enter:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Field&lt;/th>
&lt;th>Value&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Send mode&lt;/td>
&lt;td>&lt;code>SMTP&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Encryption&lt;/td>
&lt;td>&lt;code>SSL/TLS&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>From address&lt;/td>
&lt;td>&lt;code>yourname&lt;/code> @ &lt;code>gmail.com&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Server address&lt;/td>
&lt;td>&lt;code>smtp.gmail.com&lt;/code> : &lt;code>465&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Authentication&lt;/td>
&lt;td>enabled&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Credentials&lt;/td>
&lt;td>&lt;code>yourname@gmail.com&lt;/code> and the 16-character app password, without spaces&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Click &lt;strong>Save&lt;/strong>, then &lt;strong>Send email&lt;/strong> to test the settings.
&lt;code>STARTTLS&lt;/code> on port &lt;code>587&lt;/code> works as well (Encryption &lt;code>None/STARTTLS&lt;/code>).&lt;/p>
&lt;p>&lt;strong>Maintenance tasks.&lt;/strong> Next, run these two commands on the &lt;strong>Wyse&lt;/strong>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> --user www-data nextcloud-aio-nextcloud php occ maintenance:repair --include-expensive
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> --user www-data nextcloud-aio-nextcloud php occ config:system:set default_phone_region --value&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;DE&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The first command removes the warning about the MIME type migration and can run for a while; the second sets the phone region used for numbers without a country code.&lt;/p>
&lt;p>&lt;strong>Previews on the J4105.&lt;/strong> Generating previews is the main CPU load of a photo-heavy instance.
When AIO installs Nextcloud, it already caps the largest preview at 2048 instead of Nextcloud&amp;rsquo;s default of 4096 pixels and lowers the JPEG quality of previews from 80 to 60.
The first three commands below make sure that a restored or migrated instance has the same values.
The last two let Nextcloud generate two new previews at a time, and four in total, instead of four and eight on the J4105&amp;rsquo;s four cores, so that the Wyse stays responsive while it works through a large import.
Existing previews keep their size:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> --user www-data nextcloud-aio-nextcloud php occ config:system:set preview_max_x --value&lt;span class="o">=&lt;/span>&lt;span class="m">2048&lt;/span> --type&lt;span class="o">=&lt;/span>integer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> --user www-data nextcloud-aio-nextcloud php occ config:system:set preview_max_y --value&lt;span class="o">=&lt;/span>&lt;span class="m">2048&lt;/span> --type&lt;span class="o">=&lt;/span>integer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> --user www-data nextcloud-aio-nextcloud php occ config:app:set preview jpeg_quality --value&lt;span class="o">=&lt;/span>&lt;span class="m">60&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> --user www-data nextcloud-aio-nextcloud php occ config:system:set preview_concurrency_new --value&lt;span class="o">=&lt;/span>&lt;span class="m">2&lt;/span> --type&lt;span class="o">=&lt;/span>integer
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> --user www-data nextcloud-aio-nextcloud php occ config:system:set preview_concurrency_all --value&lt;span class="o">=&lt;/span>&lt;span class="m">4&lt;/span> --type&lt;span class="o">=&lt;/span>integer
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Previews can always be generated again, so keep them out of AIO&amp;rsquo;s Borg backup: that shrinks the repository, the nightly backup and the off-site upload.
AIO skips the preview folder when it holds a &lt;code>.noaiobackup&lt;/code> file.
Never put that file into the data directory itself: there it excludes every user&amp;rsquo;s files.
The snapshots on HDD 1 still contain the previews.
After restoring such a backup, run &lt;code>sudo docker exec --user www-data nextcloud-aio-nextcloud php occ files:scan-app-data preview&lt;/code> once, unless you ticked &lt;strong>Exclude previews from restore&lt;/strong>, which makes AIO run that scan by itself (&lt;a href="#944-path-b-restore-in-aio">section 9.4.4&lt;/a>).&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> --user www-data nextcloud-aio-nextcloud sh -c &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="s1">&amp;#39;d=&amp;#34;/mnt/ncdata/appdata_$(php occ config:system:get instanceid)/preview&amp;#34;; mkdir -p &amp;#34;$d&amp;#34; &amp;amp;&amp;amp; touch &amp;#34;$d/.noaiobackup&amp;#34; &amp;amp;&amp;amp; ls -l &amp;#34;$d/.noaiobackup&amp;#34;&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>See &lt;a href="https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/previews_configuration.html" target="_blank" rel="noopener">preview settings&lt;/a> and &lt;a href="https://github.com/nextcloud/all-in-one#how-to-exclude-nextclouds-data-directory-or-the-preview-folder-from-backup" target="_blank" rel="noopener">AIO backup exclusions&lt;/a> for more details.&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Optional: video transcoding with Memories&lt;/strong>, only if you use the Memories app for photos and videos.
The J4105&amp;rsquo;s integrated GPU can transcode video through VA-API; Intel&amp;rsquo;s iHD driver supports Gemini Lake.
AIO hands the GPU on to its containers when the mastercontainer itself gets &lt;code>/dev/dri&lt;/code>.
The older &lt;code>NEXTCLOUD_ENABLE_DRI_DEVICE&lt;/code> variable is deprecated.
Under AIO, Memories transcodes in its own community container.
Enable that container as its README describes, uncomment the &lt;code>devices&lt;/code> lines in &lt;code>docker-compose.yml&lt;/code>, and recreate the mastercontainer.
Then stop and start the containers in the AIO interface and turn on VA-API in Memories&amp;rsquo; admin settings:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">ls -l /dev/dri
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker compose up -d nextcloud-aio
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>See &lt;a href="https://github.com/nextcloud/all-in-one#how-to-enable-hardware-acceleration-for-nextcloud" target="_blank" rel="noopener">AIO hardware acceleration&lt;/a>, the &lt;a href="https://github.com/nextcloud/all-in-one/tree/main/community-containers/memories" target="_blank" rel="noopener">Memories community container&lt;/a> and &lt;a href="https://memories.gallery/hw-transcoding/" target="_blank" rel="noopener">Memories hardware transcoding&lt;/a> for further details.&lt;/p>
&lt;/div>
&lt;/div>
&lt;p>&lt;strong>Full-text search:&lt;/strong> when the full-text search container is enabled, AIO handles the three &lt;code>fulltextsearch&lt;/code> apps itself on every start of the Nextcloud container.
It installs and enables them, points them at its password-protected Elasticsearch, and runs the initial index once.
So instead of running &lt;code>occ&lt;/code> commands for that by hand, use AIO&amp;rsquo;s switch to enable or disable it.
New files are indexed by Nextcloud&amp;rsquo;s background jobs.
See &lt;a href="https://github.com/nextcloud/all-in-one/blob/main/Containers/nextcloud/entrypoint.sh" target="_blank" rel="noopener">AIO&amp;rsquo;s Nextcloud entrypoint&lt;/a> for details.&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
&lt;p>&lt;strong>Optional: clearing the Nextcloud log&lt;/strong>, if needed.
The log lives in the &lt;code>nextcloud_aio_nextcloud&lt;/code> volume, not in the data directory, and AIO&amp;rsquo;s backup excludes it:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo docker &lt;span class="nb">exec&lt;/span> --user www-data nextcloud-aio-nextcloud truncate -s &lt;span class="m">0&lt;/span> /var/www/html/data/nextcloud.log
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;/div>
&lt;/div>
&lt;h3 id="96-later-logins-to-the-aio-interface">9.6 Later logins to the AIO interface&lt;/h3>
&lt;p>Direct passphrase login is blocked while Nextcloud&amp;rsquo;s Apache container runs.
Open &lt;strong>Administration settings → Overview&lt;/strong> as administrator from a tailnet device and use the AIO button at the top.
It unblocks the passphrase login for your browser for a few minutes and leads to the address you used when starting the containers.
Tailscale Serve keeps the original &lt;code>Host&lt;/code> header, so that is the tailnet URL on port 8080.
Its certificate is valid, so the HSTS header that Nextcloud sends for the domain does not get in the way.&lt;/p>
&lt;p>If the sidecar is stopped or broken, use the &lt;strong>break-glass tunnel&lt;/strong> instead.
Stop Apache (&lt;code>sudo docker stop nextcloud-aio-apache&lt;/code>) and open the tunnel from the Mac:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">ssh -N -o &lt;span class="nv">ExitOnForwardFailure&lt;/span>&lt;span class="o">=&lt;/span>yes &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -L 127.0.0.1:18080:127.0.0.1:8080 wmutschl@192.168.178.55
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then open &lt;code>https://127.0.0.1:18080&lt;/code>; that endpoint uses AIO&amp;rsquo;s self-signed certificate, so the browser warning is expected.
Away from home, use &lt;code>wmutschl@dell-wyse&lt;/code> instead of the LAN address: the host&amp;rsquo;s own tailnet connection does not depend on the sidecar.&lt;/p>
&lt;p>Update AIO only through its interface, after a successful backup.
Do not put these containers under Watchtower or a similar updater; see &lt;a href="https://github.com/nextcloud/all-in-one#how-to-update-the-containers" target="_blank" rel="noopener">how to update the containers&lt;/a>.&lt;/p>
&lt;h2 id="10-backups-and-ongoing-care">10 Backups and ongoing care&lt;/h2>
&lt;h3 id="101-aio-borg-backup-to-hdd-2">10.1 AIO Borg backup to HDD 2&lt;/h3>
&lt;p>AIO&amp;rsquo;s encrypted Borg backup covers the files &lt;strong>and&lt;/strong> the database and configuration, and AIO stops the containers while it runs.
That makes it the consistent copy for Path B.
In AIO&amp;rsquo;s backup section:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Path A:&lt;/strong> enter &lt;code>/mnt/backup&lt;/code> as the backup location.
AIO shows the Borg password of the new repository; store it in your password manager.
Then click &lt;strong>Create backup&lt;/strong>, which creates the repository in &lt;code>/mnt/backup/borg&lt;/code>.&lt;/li>
&lt;li>&lt;strong>Path B:&lt;/strong> the restore already set &lt;code>/mnt/backup&lt;/code>, with the repository copied from the Mac.&lt;/li>
&lt;li>&lt;strong>Both:&lt;/strong> enable daily backups at 03:00; the field appears only once the first backup exists.
AIO reads that time as UTC, so the backup starts at 04:00 in winter and 05:00 in summer in Germany, after the 01:30 BTRBK send and before the 06:30 off-site mirror.&lt;/li>
&lt;li>&lt;strong>Both:&lt;/strong> run &lt;strong>Check backup integrity&lt;/strong> quarterly, as part of the restore drills below.&lt;/li>
&lt;/ul>
&lt;p>AIO&amp;rsquo;s daily backup can also update the containers automatically afterwards, which is reasonable once a few manual updates went smoothly.
External Storage app mounts need separate coverage; see &lt;a href="https://github.com/nextcloud/all-in-one#backup" target="_blank" rel="noopener">AIO backup coverage&lt;/a>.&lt;/p>
&lt;h3 id="102-host-configuration-and-recovery-material">10.2 Host configuration and recovery material&lt;/h3>
&lt;p>AIO&amp;rsquo;s backup does not contain the host.
The host lives in &lt;code>@root&lt;/code> and so reaches HDD 1 every night, and almost all of its configuration is in the scripts repository, under &lt;code>Dell-Wyse-Thin-Client-5070/&lt;/code> and &lt;code>Tailscale/&lt;/code>.
Keep the rest outside the Wyse as well:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>In your password manager:&lt;/strong> the OAuth secret from &lt;code>~/scripts/Dell-Wyse-Thin-Client-5070/.env&lt;/code>; the values in &lt;code>/etc/dell-wyse/host.env&lt;/code> (healthchecks.io ping key, Storage Box sub-account); the LUKS passphrases and header backups of the SSD and HDD 1; the AIO passphrase and the Borg password; the Samba password and the Storage Box passwords of the main account and the sub-account; the Home Assistant emergency kit.&lt;/li>
&lt;li>&lt;strong>Recreated by the guide rather than kept in Git&lt;/strong>, because they contain this installation&amp;rsquo;s disk UUIDs, interface names or keys: &lt;code>/etc/fstab&lt;/code>, &lt;code>/etc/crypttab&lt;/code>, &lt;code>/etc/netplan&lt;/code>, the UFW rules, and dracut-sshd with its host key and &lt;code>authorized_keys&lt;/code> (sections &lt;a href="#33-encrypt-the-system-partition-in-place">3.3&lt;/a>, &lt;a href="#4-mount-the-other-subvolumes-before-installing-docker">4&lt;/a>, &lt;a href="#5-update-and-harden-the-ubuntu-host">5&lt;/a> and &lt;a href="#72-prepare-the-two-hdds">7.2&lt;/a>).&lt;/li>
&lt;li>&lt;strong>In Tailscale:&lt;/strong> your policy file and node names.
Keep a copy of the policy file too.&lt;/li>
&lt;/ul>
&lt;p>The sidecar&amp;rsquo;s state volume needs no backup.
A rebuilt sidecar registers again with the OAuth secret.&lt;/p>
&lt;p>After a change on the host, compare it with the repository to see what has not made it there yet.
The loop compares every file under &lt;code>etc/&lt;/code> and &lt;code>usr/&lt;/code> with its counterpart on the host.
No output means that they all match; a file missing on the host shows up as &lt;code>No such file or directory&lt;/code>.
The files at the folder&amp;rsquo;s top level are not compared: the compose file and &lt;code>.env&lt;/code> are used where they are, and the templates&amp;rsquo; filled-in copies exist only on the host:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">find etc usr -type f &lt;span class="p">|&lt;/span> &lt;span class="k">while&lt;/span> &lt;span class="nb">read&lt;/span> -r f&lt;span class="p">;&lt;/span> &lt;span class="k">do&lt;/span> diff -u &lt;span class="s2">&amp;#34;/&lt;/span>&lt;span class="nv">$f&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$f&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="p">;&lt;/span> &lt;span class="k">done&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="103-snapshots-around-risky-changes">10.3 Snapshots around risky changes&lt;/h3>
&lt;p>The hourly snapshots are crash-consistent.
Before an Ubuntu release upgrade or a large AIO change, stop the Nextcloud containers through AIO, then take a consistent set by hand:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo systemctl start dell-wyse-btrbk-snapshot.service
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo btrbk list snapshots
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Restore Nextcloud through Path B rather than by rolling back &lt;code>@docker&lt;/code> on its own.
&lt;code>@containerd&lt;/code> is not snapshotted, and &lt;code>@docker&lt;/code> and &lt;code>@nextcloud&lt;/code> belong together; see &lt;a href="https://btrfs.readthedocs.io/en/latest/btrfs-subvolume.html" target="_blank" rel="noopener">BTRFS snapshot behavior&lt;/a>.&lt;/p>
&lt;h3 id="104-regular-checks">10.4 Regular checks&lt;/h3>
&lt;p>healthchecks.io reports failed and missed jobs by itself (&lt;a href="#71-alerts-to-healthchecksio">section 7.1&lt;/a>).
Trim runs weekly (&lt;a href="#51-packages-updates-and-disk-health">section 5.1&lt;/a>), the scrub monthly (&lt;a href="#74-disk-health-monthly-scrub-and-smart-monitoring">section 7.4&lt;/a>).
Look at these now and then anyway, especially after an import and after updates:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="k">for&lt;/span> fs in / /mnt/btrbk /mnt/backup&lt;span class="p">;&lt;/span> &lt;span class="k">do&lt;/span> sudo btrfs filesystem usage -T &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$fs&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="p">;&lt;/span> sudo btrfs device stats &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$fs&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="p">;&lt;/span> &lt;span class="k">done&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo btrbk list latest
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl list-timers &lt;span class="s1">&amp;#39;dell-wyse-*&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo journalctl -u dell-wyse-btrbk-send -u dell-wyse-scrub -u dell-wyse-offsite --since &lt;span class="s1">&amp;#39;40 days ago&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo ls -lh /srv/ha-backups
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker system df
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">find etc usr -type f &lt;span class="p">|&lt;/span> &lt;span class="k">while&lt;/span> &lt;span class="nb">read&lt;/span> -r f&lt;span class="p">;&lt;/span> &lt;span class="k">do&lt;/span> diff -u &lt;span class="s2">&amp;#34;/&lt;/span>&lt;span class="nv">$f&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$f&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="p">;&lt;/span> &lt;span class="k">done&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl --failed
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="105-restore-drills">10.5 Restore drills&lt;/h3>
&lt;p>A backup counts only once a restore from it has worked.
Put these into your calendar:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>When&lt;/th>
&lt;th>Drill&lt;/th>
&lt;th>Passing result&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Quarterly&lt;/td>
&lt;td>Copy one file back from the newest hourly snapshot and the same file from HDD 1 (&lt;a href="#73-hourly-snapshots-and-daily-sendreceive-with-btrbk">section 7.3&lt;/a>, &lt;strong>Getting something back&lt;/strong>)&lt;/td>
&lt;td>Both match the original (&lt;code>sha256sum&lt;/code>)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Quarterly&lt;/td>
&lt;td>&lt;strong>Check backup integrity&lt;/strong> in AIO&amp;rsquo;s backup section&lt;/td>
&lt;td>AIO reports the repository as intact&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Quarterly&lt;/td>
&lt;td>Extract one file from the newest Borg archive on the host, without AIO (below)&lt;/td>
&lt;td>The file opens, so the Borg password in your password manager works&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Quarterly&lt;/td>
&lt;td>In HA, &lt;strong>Settings → System → Backups&lt;/strong>&lt;/td>
&lt;td>The newest backup is on &lt;code>dell_wyse&lt;/code>, and the emergency kit is in your password manager&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Yearly&lt;/td>
&lt;td>Restore an HA backup from &lt;code>/srv/ha-backups&lt;/code> onto a spare SD card or into a VM, through &lt;strong>Restore from backup&lt;/strong> in HA&amp;rsquo;s onboarding, with the emergency kit&lt;/td>
&lt;td>HA starts with your configuration&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Yearly&lt;/td>
&lt;td>Compare the Storage Box mirror with HDD 2 right after a nightly run (below), and look at the Storage Box&amp;rsquo;s snapshot list in the Hetzner Console&lt;/td>
&lt;td>No differences; the snapshots are there&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Yearly&lt;/td>
&lt;td>Test HDD 1&amp;rsquo;s LUKS passphrase from your password manager, and check that the initrd still has your SSH key (below)&lt;/td>
&lt;td>The passphrase is accepted; your key is listed&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Yearly&lt;/td>
&lt;td>Go through the recovery material listed above&lt;/td>
&lt;td>Every password and file is there and works&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>&lt;strong>One file from Borg, without AIO.&lt;/strong> Run this on the &lt;strong>Wyse&lt;/strong> outside the nightly jobs, which hold the repository from AIO&amp;rsquo;s backup at 03:00 UTC until the off-site copy finishes.
Borg asks for AIO&amp;rsquo;s Borg password.
AIO uses Borg 1.4, so check that &lt;code>borg --version&lt;/code> on the host shows a 1.x version too.
Archive names end in &lt;code>-nextcloud-aio&lt;/code>, and the paths inside an archive are best found by listing:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo apt install --no-install-recommends borgbackup -y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo borg list /mnt/backup/borg
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo borg list /mnt/backup/borg::ARCHIVE &lt;span class="p">|&lt;/span> grep &lt;span class="s1">&amp;#39;/USER_ID/files/&amp;#39;&lt;/span> &lt;span class="p">|&lt;/span> head
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">$(&lt;/span>mktemp -d&lt;span class="k">)&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo borg extract /mnt/backup/borg::ARCHIVE &lt;span class="s1">&amp;#39;PATH/AS/LISTED/ABOVE&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>HDD 1&amp;rsquo;s passphrase and the SSH unlock.&lt;/strong> The SSD&amp;rsquo;s passphrase gets tested at every boot.
HDD 1&amp;rsquo;s is never typed, because its keyfile opens it, so &lt;code>cryptsetup&lt;/code> asks for it here.
Use the path of your HDD 1 from &lt;a href="#72-prepare-the-two-hdds">section 7.2&lt;/a>.
The last command prints the keys that the initrd accepts:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo cryptsetup open --test-passphrase /dev/disk/by-id/usb-WD_Elements_2621_57583632443334335444584A-0:0-part1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo lsinitrd -f root/.ssh/authorized_keys /boot/initrd.img-&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">$(&lt;/span>uname -r&lt;span class="k">)&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Storage Box comparison.&lt;/strong> Empty output means that the mirror matches HDD 2 byte for byte.
The check reads the whole repository on both sides, which takes hours but transfers almost nothing:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">sudo bash -c &lt;span class="s1">&amp;#39;. /etc/dell-wyse/host.env; rsync -rc --delete --dry-run --itemize-changes --exclude=&amp;#34;/lock.*&amp;#34; \
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1"> -e &amp;#34;ssh -p ${OFFSITE_PORT:-23} -i /root/.ssh/dell-wyse-offsite&amp;#34; /mnt/backup/borg/ &amp;#34;$OFFSITE_TARGET:borg/&amp;#34;&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="106-updates">10.6 Updates&lt;/h3>
&lt;ul>
&lt;li>
&lt;p>&lt;strong>Ubuntu:&lt;/strong> security updates, including ESM, install automatically.
Livepatch covers urgent kernel fixes until the next reboot; still reboot in a maintenance window when &lt;code>/var/run/reboot-required&lt;/code> appears.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Boot chain:&lt;/strong> every reboot waits for the SSH unlock, which runs from other machines at home or over Tailscale (&lt;a href="#57-unlocking-the-system-disk-over-ssh">section 5.7&lt;/a>).
After changing your SSH keys, update &lt;code>/etc/dracut-sshd/authorized_keys&lt;/code> and rebuild the initrd (&lt;a href="#57-unlocking-the-system-disk-over-ssh">section 5.7&lt;/a>).
Check &lt;a href="https://github.com/gsauthof/dracut-sshd/tags" target="_blank" rel="noopener">dracut-sshd&amp;rsquo;s releases&lt;/a> once a year.
To update, run &lt;code>git fetch --tags&lt;/code> in &lt;code>~/dracut-sshd&lt;/code> and review what changed (&lt;code>git diff 0.7.1 NEW_TAG -- 46sshd&lt;/code>), then check out the new tag, replace &lt;code>/usr/lib/dracut/modules.d/46sshd&lt;/code> with its &lt;code>46sshd&lt;/code> and rebuild the initrd.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Docker packages:&lt;/strong> a reviewed &lt;code>sudo apt full-upgrade&lt;/code> in a maintenance window, as they restart the daemon and with it all containers.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>AIO:&lt;/strong> only through its interface, after a backup, or through its automatic update after the daily backup.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Tailscale on the host:&lt;/strong> updates itself (&lt;code>tailscale set --auto-update&lt;/code>, &lt;a href="#82-on-the-wyse">section 8.2&lt;/a>).&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Tailscale sidecar:&lt;/strong> AIO does not manage its image.
Update it occasionally:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/scripts/Dell-Wyse-Thin-Client-5070
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker compose pull nextcloud-tailscale
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo docker compose up -d nextcloud-tailscale
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>&lt;strong>Scripts repository:&lt;/strong> after &lt;code>git pull&lt;/code> in &lt;code>~/scripts&lt;/code>, run &lt;code>sudo docker compose up -d&lt;/code> in &lt;code>~/scripts/Dell-Wyse-Thin-Client-5070&lt;/code>, so that the containers pick up changes to the compose file or &lt;code>.env&lt;/code>.
A restart or reboot keeps a container&amp;rsquo;s old settings, and a sidecar whose serve file was renamed then starts without any serve configuration.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;p>healthchecks.io watches the backups and SMART, but open its dashboard now and then.
Avoid automatic volume-pruning scripts.
If the logs grow excessively, a journald drop-in can set a compact journal limit, while retaining enough history to investigate failures.&lt;/p></description></item></channel></rss>