grahamc / packet-nixos

The images used by Packet.net's deployment process.
MIT License
35 stars 10 forks source link

Support ZFS #19

Open grahamc opened 5 years ago

grahamc commented 5 years ago

We'll do the ZFS thing if a tag named "zfs" exists on the instance on startup.

Possibly in the future, we'll support something like CPR in the customtdata field (yes, customdata - not userdata) but not right now. Would be nicer for CPR to just support ZFS.

Here are some commands Clever likes.

  zpool create -o ashift=12 -o altroot=/mnt -O compression=lz4 ${cfg.poolName} $ROOT_DEVICE
  zfs create -o mountpoint=legacy ${cfg.poolName}/root
  zfs create -o mountpoint=legacy ${cfg.poolName}/home
  zfs create -o mountpoint=legacy ${cfg.poolName}/nix
  swapon $SWAP_DEVICE
  mount -t zfs ${cfg.poolName}/root /mnt/
  mkdir /mnt/{home,nix,boot}
  mount -t zfs ${cfg.poolName}/home /mnt/home/
  mount -t zfs ${cfg.poolName}/nix /mnt/nix/
  mount $NIXOS_BOOT /mnt/boot/
  nixos-generate-config --root /mnt/