Last active
September 8, 2016 04:51
-
-
Save jojomi/94d09ed82c46fd97d647 to your computer and use it in GitHub Desktop.
Chrooting into an encrypted disk
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 | |
set -e | |
DISK_ENCRYPTED=/dev/sda2 | |
DISK_BOOT=/dev/sda1 | |
VG_NAME=cryptVG | |
echo 'chrooting' | |
lsblk | |
cryptsetup open $DISK_ENCRYPTED root | |
ls -la /dev/mapper/ | |
ls -la /dev/mapper/root | |
mkdir --parents /mnt/arch | |
pacman -Syy | |
pacman -S gnome-disk-utility lvm2 | |
modprobe dm-mod | |
lsmod | grep dm_crypt | |
vgscan | |
vgchange -ay $VG_NAME | |
ls /dev/mapper/ | |
mount /dev/mapper/$VG_NAME-root /mnt/arch/ | |
mount $DISK_BOOT /mnt/arch/boot/ | |
cd /mnt/arch | |
mount -t proc proc proc/ | |
mount --rbind /sys sys/ | |
mount --rbind /dev dev/ | |
cp /etc/resolv.conf etc/resolv.conf | |
chroot /mnt/arch /bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment