Last active
July 19, 2018 21:08
-
-
Save samschlegel/4dcd743355060147843cdd8a80064d54 to your computer and use it in GitHub Desktop.
chrooting on LVM-on-LUKS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Enter chroot | |
cryptsetup luksOpen /dev/nvme0n1p5 system | |
mkdir -p /mnt/root | |
mount /dev/mapper/system-root /mnt/root | |
mount /dev/mapper/system-boot /mnt/root/boot | |
mount /dev/mapper/system-home /mnt/root/home | |
mount /dev/nvme0n1p2 /mnt/root/boot/efi | |
mount --bind /dev /mnt/root/dev | |
mount --bind /run /mnt/root/run | |
chroot /mnt/root | |
# Setup once in chroot | |
mount --types=proc proc /proc | |
mount --types=sysfs sys /sys | |
# Do what you need | |
refreshgrub | |
# Exit and cleanup | |
exit | |
umount -R /mnt/root | |
vgchange -an system | |
cryptsetup luksClose system |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment