Linux系统维护必备命令--chroot

  
  
  
  
mount /dev/sdx /mnt/gentoo
mount -t proc none /mnt/gentoo/proc/
mount -t proc proc /mnt/gentoo/proc/
mount --rbind /sys /mnt/gentoo/sys/
mount --rbind /dev /mnt/gentoo/dev/
mount --rbind /tmp /mnt/gentoo/tmp (gentoo)
可选:mount --rbind /run /mnt/arch/run (arch)
DNS: cp /etc/resolv.conf etc/resolv.conf
chroot /mnt/gentoo /bin/bash
env-update (gentoo)
source /etc/profile

Optionally, create a unique prompt to be able to differentiate your chroot environment:

  
  
  
  
export PS1="(chroot) $PS1"

你可能感兴趣的:(chroot)