Last active
June 1, 2023 08:09
-
-
Save lemajes/5ea14e7ec6ac5687c27bb0e8dace3de2 to your computer and use it in GitHub Desktop.
[RESCUE CHROOT] Rescue chroot #rescue #chroot #ovh #debian
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/bash | |
TARGET_DIR=/mnt/chroot | |
mkdir ${TARGET_DIR} | |
mount /dev/sdb1 ${TARGET_DIR} | |
sudo mount -t sysfs /sys ${TARGET_DIR}/sys | |
sudo mount -t proc /proc ${TARGET_DIR}/proc | |
sudo mount --bind /dev ${TARGET_DIR}/dev | |
sudo mount -t devpts /dev/pts ${TARGET_DIR}/dev/pts | |
sudo mount --bind /tmp ${TARGET_DIR}/tmp | |
sudo chroot ${TARGET_DIR}/ /bin/bash | |
#or | |
mkdir /USB; mount /dev/sdb1 /USB;for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /USB$i; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment