Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for chroot

February 15, 2020

Chroot Shortcut

Here’s a quick way to setup a chrooted environment.

mkdir /helper
for i in proc sys dev; do mount o bind /$i /helper/$i; done
chroot /helper

mkdir /helper for i in proc sys dev; do mount o bind /$i /helper/$i; done chroot /helper

August 19, 2019

Chroot A Boot Disk

Here’s a quick way to chroot another boot disk. Attach the rescued boot disk first. Run lsblk and mount.

lsblk
mount -t xfs -o nouuid /dev/xvdf2 /mnt
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /dev /mnt/dev
chroot /mnt
cd /mnt
exit

lsblk mount -t xfs -o nouuid /dev/xvdf2 /mnt mount --bind /proc /mnt/proc mount --bind /sys /mnt/sys mount --bind /dev /mnt/dev chroot /mnt cd /mnt exit

Unmount when done.

umount /mnt/proc
umount /mnt/dev
umount /mnt/sys
umount /mnt

umount /mnt/proc umount /mnt/dev umount /mnt/sys umount /mnt

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021