Zark 2.1: bare-metal backup and recovery for Ubuntu 24.04 and 26.04 LTS on encrypted ZFS

zark is free software (Apache 2.0) that backs up an Ubuntu system installed on encrypted ZFS to an external drive, still encrypted, and rebuilds it on a new disk from a live USB, booting with Secure Boot on the stock Ubuntu boot chain. I am the author; zark is an independent project, not affiliated with Canonical. This post introduces version 2.1 and asks for discussion and testing.

Who it is for. People running Ubuntu 24.04 LTS or 26.04 LTS, installed with the installer’s encrypted ZFS layout, with Secure Boot on. It does not claim to support other releases or layouts.

What it does.

  • Backups are raw ZFS sends, so the external drive holds encrypted data and never needs the keys.
  • Each drive is tracked with a ZFS bookmark. A drive can stay unplugged for months and the laptop’s snapshot pruning no longer cuts it loose.
  • Nothing on a drive is destroyed without a question, asked before the transfer starts.
  • Every backup is checked on the drive before zark says it is safe to disconnect it.
  • A backup is reported as completed only when every expected dataset reached the new point. Otherwise the result is BACKUP INCOMPLETE, the exit code is 1 and a table shows what happened to each dataset.
  • zark recover, run from an Ubuntu live USB, rebuilds the system on a new disk. On my test laptop it reached RECOVERY COMPLETE in 3m10s and in 3m25s; with more data, add the time to copy it. A daily backup of my laptop takes about two minutes.
  • zark selftest checks that the machine’s ZFS, kernel and tools behave the way zark relies on. Each release publishes the results from my test machine.

New in 2.1. zark writes its state to two status files that any program can read without root. zark monitor follows a running backup from another terminal, as any user. On Ubuntu 26.04 a GNOME Shell extension shows the same in the top bar and sends notifications when a backup is overdue or a backup drive is plugged in. It never starts or changes anything.

Install.

sudo add-apt-repository ppa:juanmitaboada/zark
sudo apt update
sudo apt install zark
# Ubuntu 26.04, GNOME extension:
sudo apt install gnome-shell-extension-zark

For a recovery there is no installed system, so zark also ships as a portable tarball on the releases page; it runs from an Ubuntu 26.04 live USB.

Warning. zark partitions disks and destroys pools when you ask it to. Read what zark touches first, and keep at least one backup that does not depend on zark.

Where it came from. After a laptop with soldered storage went through three motherboards, and after version 1 reported a backup as complete when one drive had stopped following one part of the system, I rebuilt it as 2.0. The account is here: https://www.juanmitaboada.com/my-laptop-lost-its-disk-three-times-so-i-wrote-zark/

What would help.

Code and documentation: https://github.com/juanmitaboada/zark
Explainer video: https://youtu.be/RW7M9PC5les

1 Like

zark 2.2.0 is out, in the same PPA for noble, resolute and now stonking:

  • Ubuntu 26.10 is supported. Its installer puts /boot on ext4 with no bpool;
    zark setup creates an encrypted copy of /boot inside the boot environment,
    so every backup point holds the root and its /boot together, and recover
    rebuilds that layout on a new disk.
  • On 24.04, before the release upgrade to 26.04: on an encrypted ZFS root the
    graphical upgrade can stop halfway because of a renamed key unit in Ubuntu’s
    ZFS packages (not zark’s bug). zark now warns about it, and
    docs/UPGRADING.md has the steps that avoid it:
    zark/docs/UPGRADING.md at main · juanmitaboada/zark · GitHub
  • Drives are recognised by the disk, not by the USB enclosure, so two disks
    that went through the same enclosure are no longer confused.
  • The GNOME Shell extension 1.1 supports Shell 51 (26.10).

Release notes: Release zark 2.2.0 · juanmitaboada/zark · GitHub

1 Like

zark 2.3.0 is out, in the PPA for 24.04, 26.04 and 26.10.

What changed:

  • Kernel updates with a backup drive plugged in. In 2.2, a kernel removed by apt autoremove or unattended-upgrades with a drive plugged in left dpkg half-done. Now a drive that is only plugged in is left out of update-grub’s scan, so those removals complete. update-grub also stops before it installs a grub.cfg with no kernel entry, so the previous one stays; Ubuntu’s own fix for the root-on-ZFS case is proposed in LP #2016778.
  • zark fullcheck verifies a backup drive’s copies without changing them: it imports the drive read-only, mounts each dataset that recover would restore and reads every file, then scrubs the pool. On an encrypted drive it names the damaged files.
  • zark no longer imports a backup pool while apt, dpkg or unattended-upgrades is running.

After sudo apt upgrade, run sudo zark setup once to install 2.3’s guards.

The GNOME Shell extension 1.2 adds an About tab with the versions and copy buttons for the usual commands.

Release notes: Release zark 2.3.0 · juanmitaboada/zark · GitHub

zark 2.3.1 is out, in the PPA for 24.04, 26.04 and 26.10. It fixes one situation: a backup drive that goes away during a backup (unplugged, or a USB link that drops).

  • An ssh login, apt or update-grub no longer hangs on a pool whose drive went away.
  • zark backup notices the loss, starts no further transfer and never marks the run complete. It prints the way out: unplug the drive and run the forced reboot it shows, or plug the drive back in and run sudo zpool clear , which on OpenZFS 2.4 can crash the ZFS module (OpenZFS #18394). zark never runs the clear itself.

After sudo apt upgrade, run sudo zark setup once: until then the guards installed by 2.3.0 stay, and they are what hangs.

Also new, from the same PPA: zark for GNOME, a separate app that shows your backups and backup drives in one window and runs zark’s operations (back up, browse, prepare a drive, check, exclusions, retention) in a terminal inside it, each under its own polkit action. It needs zark 2.3.0 or later:

sudo apt install zark-gnome-app

Release notes: Release zark 2.3.1 · juanmitaboada/zark · GitHub
The app: GitHub - juanmitaboada/zark-gnome-app: GNOME app for zark: the state of your ZFS backups and backup drives, read from zark's status files. GTK 4 and libadwaita, Ubuntu 24.04 on. · GitHub

Hello, thank you for sharing.

I moved your post to the lounge, tips & tricks section.

2 Likes