{"id":13930219,"url":"https://github.com/snsinfu/hetzner-zfs-image","last_synced_at":"2026-02-07T21:34:57.903Z","repository":{"id":92654165,"uuid":"324949939","full_name":"snsinfu/hetzner-zfs-image","owner":"snsinfu","description":"Scripts to create a reusable Hetzner cloud image that boots Debian on ZFS root","archived":false,"fork":false,"pushed_at":"2023-03-30T07:21:45.000Z","size":12,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-08T18:26:50.806Z","etag":null,"topics":["debian","hetzner-cloud","packer","terraform","zfs"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snsinfu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-12-28T08:03:18.000Z","updated_at":"2023-11-13T13:47:10.000Z","dependencies_parsed_at":"2023-08-22T00:15:12.213Z","dependency_job_id":null,"html_url":"https://github.com/snsinfu/hetzner-zfs-image","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snsinfu%2Fhetzner-zfs-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snsinfu%2Fhetzner-zfs-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snsinfu%2Fhetzner-zfs-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snsinfu%2Fhetzner-zfs-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snsinfu","download_url":"https://codeload.github.com/snsinfu/hetzner-zfs-image/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226607614,"owners_count":17658483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debian","hetzner-cloud","packer","terraform","zfs"],"created_at":"2024-08-07T18:05:15.783Z","updated_at":"2026-02-07T21:34:57.897Z","avatar_url":"https://github.com/snsinfu.png","language":"Shell","funding_links":[],"categories":["terraform"],"sub_categories":[],"readme":"# Hetzner Debain ZFS image\n\nPacker and Terraform scripts to create a reusable Hetzner cloud image that\nboots Debian on ZFS root.\n\n- [Usage](#usage)\n- [How it works](#how-it-works)\n- [License](#license)\n\n\n## Usage\n\n### Create a local image\n\nRequirements: Packer and VirtualBox.\n\n```console\n$ cd image\n$ make\n...\n$ ls debian.img\ndebian.img\n```\n\nThe `make` command builds a raw disk image. Packer emulates key input to the\nvirtual machine console to bootstrap installation, so do not touch mouse nor\nkeyboard until packer sshs into the machine.\n\nYou may need to change livecd version in `image/build.pkr.hcl` to the latest\nrelease. Otherwise, packer fails to download the livecd iso because Debian\nproject may delete old livecd images.\n\n\n### Tranfer to Hetzner cloud\n\nRequirements: Terraform, curl and Hetzner Cloud API token.\n\n```console\n$ cd snapshot\n$ export HCLOUD_TOKEN=...\n$ make\n...\n$ make clean\n```\n\nThe `make` command spins up a rescue-mode CX11 instance on the Hetzner Cloud,\nsshs into the instance and transfers the image to the main disk of the\ninstance. Then, it takes a snapshot of the image. You need to `make clean`\nyourself to destroy the server.\n\nThe size of the snapshot is ~900MB. The storage cost then is ~0.01 €/month.\n\n\n### Using the image\n\nThe image is labeled with `image`=`debian-11-zfs`. You may want to use this\nlabel to select the image in a Terraform configuration.\n\nThe image forbids root login and password authentication. You should supply the\nfollowing cloudinit configuration or similar to the instance as a *user data*:\n\n```yaml\n#cloud-config\n\ntimezone: UTC\n\nsystem_info:\n  default_user:\n    name: hetzner\n    shell: /bin/bash\n    sudo: \"ALL=(ALL) NOPASSWD: ALL\"\n```\n\nThis will create non-root user `hetzner`. Public keys will be injected to this\nuser. You will see ZFS dataset in the created instance:\n\n```console\n$ df -h\nFilesystem      Size  Used Avail Use% Mounted on\nudev            958M     0  958M   0% /dev\ntmpfs           195M  3.0M  192M   2% /run\nmain/debian      37G  752M   36G   3% /\ntmpfs           974M     0  974M   0% /dev/shm\ntmpfs           5.0M     0  5.0M   0% /run/lock\ntmpfs           974M     0  974M   0% /sys/fs/cgroup\n/dev/sda2       488M   49M  404M  11% /boot\n$ sudo zfs list\nNAME          USED  AVAIL     REFER  MOUNTPOINT\nmain          753M  35.7G       96K  none\nmain/debian   752M  35.7G      752M  /\n```\n\n\n## How it works\n\nThe packer script installs [Debian root-on-zfs][root-on-zfs] to a local virtual\nmachine by chrooting from a livecd shell. The Makefile uses `vbox-img` to\nconvert virtual hard disk to raw disk image. Then, `snapshot` scripts boot a\nrescue linux system on a cloud instance and write the disk image directly to\nthe instance main disk. The snapshot of the instance then works as a Debian\nZFS image.\n\nBooting an instace based on the created image runs first-boot sequence\nincluding cloud-init, which automatically configures the system just like other\nofficial images (including the auto-configured root password and injected SSH\npubkeys).\n\n[root-on-zfs]: https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Buster%20Root%20on%20ZFS.html\n\n\n## License\n\nMIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnsinfu%2Fhetzner-zfs-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnsinfu%2Fhetzner-zfs-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnsinfu%2Fhetzner-zfs-image/lists"}