nixos-config/misc/luks-mirror.sh

16 lines
532 B
Bash
Raw Normal View History

2021-06-28 01:20:04 +00:00
#!/usr/bin/env bash
2021-06-28 03:45:04 +00:00
set -ex
2021-06-28 01:20:04 +00:00
2021-06-28 03:45:04 +00:00
cryptsetup -y -v luksFormat "/dev/disk/by-partlabel/_root1"
cryptsetup -y -v luksFormat "/dev/disk/by-partlabel/_root2"
cryptsetup --allow-discards open "/dev/disk/by-partlabel/_root1" cryptroot1
cryptsetup --allow-discards open "/dev/disk/by-partlabel/_root2" cryptroot2
2021-06-28 01:20:04 +00:00
mkfs.btrfs -f -L_root -mraid1 -draid1 /dev/mapper/cryptroot1 /dev/mapper/cryptroot2
mount /dev/disk/by-label/_root /mnt -o discard,compress=zstd:1
btrfs subvolume create /mnt/home
btrfs subvolume create /mnt/nix
mkdir /mnt/boot