use partition labels in format scripts

This commit is contained in:
Sean Buckley 2021-06-27 23:45:04 -04:00
parent 3d8ada839e
commit 6e7ea74cd2
2 changed files with 8 additions and 13 deletions

View file

@ -1,14 +1,11 @@
#!/usr/bin/env bash
set -e
read -p "Path to new LUKS device 1: " blkdevA
read -p "Path to new LUKS device 2: " blkdevB
set -x
set -ex
cryptsetup -y -v luksFormat "$blkdevA"
cryptsetup -y -v luksFormat "$blkdevB"
cryptsetup --allow-discards open "$blkdevA" cryptroot1
cryptsetup --allow-discards open "$blkdevB" cryptroot2
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
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

View file

@ -1,11 +1,9 @@
#!/usr/bin/env bash
set -e
read -p "Path to new LUKS device: " blkdev
set -x
set -ex
cryptsetup -y -v luksFormat "$blkdev"
cryptsetup --allow-discards open "$blkdev" cryptroot
cryptsetup -y -v luksFormat "/dev/disk/by-partlabel/_root"
cryptsetup --allow-discards open "/dev/disk/by-partlabel/_root" cryptroot
mkfs.btrfs -f -L_root /dev/mapper/cryptroot
mount /dev/disk/by-label/_root /mnt -o discard,compress=zstd:1