mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
use partition labels in format scripts
This commit is contained in:
parent
3d8ada839e
commit
6e7ea74cd2
2 changed files with 8 additions and 13 deletions
|
@ -1,14 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
set -ex
|
||||||
read -p "Path to new LUKS device 1: " blkdevA
|
|
||||||
read -p "Path to new LUKS device 2: " blkdevB
|
|
||||||
set -x
|
|
||||||
|
|
||||||
cryptsetup -y -v luksFormat "$blkdevA"
|
cryptsetup -y -v luksFormat "/dev/disk/by-partlabel/_root1"
|
||||||
cryptsetup -y -v luksFormat "$blkdevB"
|
cryptsetup -y -v luksFormat "/dev/disk/by-partlabel/_root2"
|
||||||
cryptsetup --allow-discards open "$blkdevA" cryptroot1
|
cryptsetup --allow-discards open "/dev/disk/by-partlabel/_root1" cryptroot1
|
||||||
cryptsetup --allow-discards open "$blkdevB" cryptroot2
|
cryptsetup --allow-discards open "/dev/disk/by-partlabel/_root2" cryptroot2
|
||||||
|
|
||||||
mkfs.btrfs -f -L_root -mraid1 -draid1 /dev/mapper/cryptroot1 /dev/mapper/cryptroot2
|
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
|
mount /dev/disk/by-label/_root /mnt -o discard,compress=zstd:1
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
set -ex
|
||||||
read -p "Path to new LUKS device: " blkdev
|
|
||||||
set -x
|
|
||||||
|
|
||||||
cryptsetup -y -v luksFormat "$blkdev"
|
cryptsetup -y -v luksFormat "/dev/disk/by-partlabel/_root"
|
||||||
cryptsetup --allow-discards open "$blkdev" cryptroot
|
cryptsetup --allow-discards open "/dev/disk/by-partlabel/_root" cryptroot
|
||||||
|
|
||||||
mkfs.btrfs -f -L_root /dev/mapper/cryptroot
|
mkfs.btrfs -f -L_root /dev/mapper/cryptroot
|
||||||
mount /dev/disk/by-label/_root /mnt -o discard,compress=zstd:1
|
mount /dev/disk/by-label/_root /mnt -o discard,compress=zstd:1
|
||||||
|
|
Loading…
Reference in a new issue