Last active
May 18, 2023 21:29
-
-
Save KiLLeRRaT/c6e112fd61ebf0bcb865bc70f796e6b7 to your computer and use it in GitHub Desktop.
Mount a BTRFS partition and chroot into it
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
#!/bin/sh | |
# https://gist.github.com/KiLLeRRaT/c6e112fd61ebf0bcb865bc70f796e6b7 | |
set -e | |
lsblk # FIND THE PARTITION NAME | |
echo "Enter the partition name: " | |
read PARTITIONNAME | |
cryptsetup luksOpen /dev/$PARTITIONNAME myvol | |
mkdir /mnt/myvol | |
mount -o subvol=@ /dev/mapper/myvol /mnt/myvol | |
mount /proc /mnt/myvol/proc --bind | |
mount /dev /mnt/myvol/dev --bind | |
mount /sys /mnt/myvol/sys --bind | |
echo "Do you have a separate boot partition? (y/n)" | |
read ANSWER | |
if [ "$ANSWER" = "y" ]; then | |
echo "Enter the boot partition name: " | |
read BOOTPARTITIONNAME | |
mount /dev/$BOOTPARTITIONNAME /mnt/myvol/boot | |
fi | |
echo "Do you have a separate EFI partition? (y/n)" | |
read ANSWER | |
if [ "$ANSWER" = "y" ]; then | |
echo "Enter the EFI partition name: " | |
read EFIPARTITIONNAME | |
mount /dev/$EFIPARTITIONNAME /mnt/myvol/boot/efi | |
fi | |
chroot /mnt/myvol | |
#vim /etc/default/grub | |
#update-grub | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment