Chroot笔记

#Linux

创建镜像

dd if=/dev/zero of=fs.img count=5000 bs=1M
mkfs.ext4 fs.img

挂载

mount fs.img /mnt
cd /mnt
mount -t proc /proc proc/
mount -t sysfs /sys sys/
mount --rbind /dev dev/
cp /etc/resolv.conf etc/resolv.conf

进入Chroot环境

chroot /mnt /bin/bash -l