[转]chroot的使用

chroot,即 change root directory (更改 root 目录)。在 linux 系统中,系统默认的目录结构都是以 `/`,即是以根 (root) 开始的。而在使用 chroot 之后,系统的目录结构将以指定的位置作为 `/` 位置。

实例:

用live CD ubuntu

假设你的linux安装在sda1

sudo mount  /dev/sda1    /mnt/     #将sda1挂载到/mnt/

sudo   chroot     /mnt/                 #将/mnt/指定为"/"

好了,现在你的根目录为/mnt/,即为/dev/sda1,也就是你硬盘内的linux根目录,

你的运行环境为硬盘的linux了!

转自http://hi.baidu.com/roothoo/item/53e9274864c23208c0161371

注意:

如果想退出chroot环境 , 即系所谓的想chroot回原目录,直接exit就得了

posted @ 2013-04-02 00:54  Gateman  阅读(180)  评论(0编辑  收藏  举报