This repository has been archived on 2024-07-08. You can view files and clone it, but cannot push or open issues or pull requests.
nix-config-tn/docs/vm/installing-zfs-impermance.md

58 lines
1.4 KiB
Markdown
Raw Normal View History

> https://grahamc.com/blog/erase-your-darlings/
2024-04-10 05:10:28 -05:00
# Get hostid
run `head -c 8 /etc/machine-id`
and copy into networking.hostId to ensure ZFS doesnt get borked on reboot
# Partitioning
2024-04-10 05:10:28 -05:00
parted /dev/nvme0n1 -- mklabel gpt
parted /dev/nvme0n1 -- mkpart root ext4 512MB -8GB
parted /dev/nvme0n1 -- mkpart swap linux-swap -8GB 100%
parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB
parted /dev/nvme0n1 -- set 3 esp on
# Formatting
2024-04-10 05:10:28 -05:00
mkswap -L swap /dev/nvme0n1p2
2024-04-10 05:10:28 -05:00
swapon /dev/nvme0n1p2
mkfs.fat -F 32 -n boot /dev/nvme0n1p3
# ZFS on root partition
2024-04-10 05:10:28 -05:00
zpool create -O mountpoint=none rpool /dev/nvme0n1p1
2024-04-10 05:10:28 -05:00
zfs create -p -o mountpoint=legacy rpool/local/root
## immediate blank snapshot
2024-04-10 05:10:28 -05:00
zfs snapshot rpool/local/root@blank
mount -t zfs rpool/local/root /mnt
# Boot partition
2024-04-10 05:10:28 -05:00
mkdir /mnt/boot
mount /dev/nvme0n1p3 /mnt/boot
#mk nix
zfs create -p -o mountpoint=legacy rpool/local/nix
mkdir /mnt/nix
mount -t zfs rpool/local/nix /mnt/nix
# And a dataset for /home: if needed
zfs create -p -o mountpoint=legacy rpool/safe/home
mkdir /mnt/home
mount -t zfs rpool/safe/home /mnt/home
zfs create -p -o mountpoint=legacy rpool/safe/persist
mkdir /mnt/persist
mount -t zfs rpool/safe/persist /mnt/persist
2024-04-10 05:10:28 -05:00
Set ` networking.hostid`` in the nixos config to `head -c 8 /etc/machine-id`
2024-04-10 05:12:34 -05:00
nixos-install --impure --flake github:truxnell/nix-config#<MACHINE_ID>
2024-04-10 05:50:09 -05:00
consider a nixos-enter to import a zpool if required (for NAS) instead of rebooting post-install