switch_root vs pivot_root vs chroot【转】
1. pivot_root can/should be used together with chroot
pivot_root new_root put_old
pivot_root moves the root file system of the current process to the
directory put_old and makes new_root the new root file system.
cd new_root
pivot_root . old-root
exec chroot . command umount /old-root
Note that chroot must be available under the old root and under the new root, because pivot_root may or may not have implicitly changed the root directory of the shell.
2. switch_root newroot init [arg...]
switch_root moves already mounted /proc, /dev and /sys to newroot and
makes newroot the new root filesystem and starts init process. switch_root is typically used with initramfs. WARNING: switch_root removes recursively all files and directories on
the current root filesystem.
The following shell script fragment demonstrates how to use switch_root:
# First, find and mount the new filesystem.
mkdir /newroot
mount /dev/whatever /newroot # Unmount everything else you've attached to rootfs. (Moving the filesystems
# into newroot is something useful to do with them.) mount --move /sys /newroot/sys
mount --move /proc /newroot/proc
mount --move /dev /newroot/dev # Now switch to the new filesystem, and run /sbin/init out of it. Don't
# forget the "exec" here, because you want the new init program to inherit
# PID 1. exec switch_root /newroot /sbin/init
switch_root vs pivot_root vs chroot【转】的更多相关文章
- slax linux的定制
由于数据结构教学的需要,需要用到linux,要求就是小,启动快,可定制性强,恰好slax正好满足要求,以下就是定制slax linux的过程记录: 什么是Slax Slax是一个基于Linux的Liv ...
- linux系统 initrd.img中init启动脚本分析
概述:这篇文章主体内容来源于网上转载.前面几篇文章倾向于制作initrd.img,这篇文章更倾向于initrd.img的运行过程:加载framebuff驱动 ide驱动和文件系统驱动,最后进入到真正的 ...
- Docker 核心技术与实现原理
提到虚拟化技术,我们首先想到的一定是 Docker,经过四年的快速发展 Docker 已经成为了很多公司的标配,也不再是一个只能在开发阶段使用的玩具了.作为在生产环境中广泛应用的产品,Docker 有 ...
- mount rootfs
主要用到的命令为pivot_root,可man 8 pivot_root了解用法. 1. pivot_root - change the root filesystem pivot_root new_ ...
- [转载] Docker 实现原理
目录 Namespaces 进程 网络 libnetwork 挂载点 chroot CGroups UnionFS 存储驱动 AUFS 其他存储驱动 总结 原文链接:https://dravenes ...
- 后端技术杂谈10:Docker 核心技术与实现原理
本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.com/h2pl/Java-Tutorial 喜欢的话麻烦点下 ...
- docker 学习路线
docker 学习路线 参考资料 知乎 docker 的学习路线 Docker - 从入门到实践 Docker 核心技术与实现原理 Docker 入门 <Kubernetes in Action ...
- 【转】Docker 核心技术与实现原理
转自:https://draveness.me/docker 提到虚拟化技术,我们首先想到的一定是 Docker,经过四年的快速发展 Docker 已经成为了很多公司的标配,也不再是一个只能在开发阶段 ...
- 理解 chroot
什么是 chroot chroot,即 change root directory (更改 root 目录).在 linux 系统中,系统默认的目录结构都是以 `/`,即是以根 (root) 开始的. ...
随机推荐
- ansible批量自动安装LNMP
- mysql in 子查询 效率慢,对比
desc SELECT id,detail,groupId from hs_knowledge_point where groupId in ( UNION all ) UNION ALL SELEC ...
- win7系统标准用户恢复administrator账号方法
一次误操作,把管理员账号给禁用了,满眼的泪花~~~~~~~~~ 标准用户,什么都干不了,怎么办呢????? 度娘一下,各种奇葩答案,就是解决不了 呵呵,最后找到了解决方法: 1.开机后BIOS过后,按 ...
- layabox 1 基础
屏幕适配: class GameMain{ public static gameStart:GameStart; public static gameView:GameView; public sta ...
- java_30对文件的操作
1.导包 导commons-io-2.4.jar包 2. public class Demo1Commons { public static void main(String[] args) { fu ...
- blender基础操作
旋转:鼠标中键 左右移动:鼠标中键+左shift 放大缩小:鼠标滚轮滚动 blender旋转以锁定物件作为中心点旋转 blender选取物件用鼠标右键, 选中物件之后,利用数字键盘中的点(Del) 来 ...
- laravel的路由分组,中间件,命名空间,子域名,路由前缀
laravel的路由分组,就是把一些具有相同特征的路由进行分组,比如一些路由需要进行验证,一些路由有共同的前缀,一些路由有相同的控制器命名空间等. 这样把路由组合在一起,方便管理,维护性更好. Rou ...
- 移值UCOS2到M4核与M3核的区别
之前移值过ucos2到stm32f2系列的单片机,这个单片机是属于arm的m3内核的.最近在学习永磁同步电机的控制,对于这个电机的控制,有比较多的数学计算,甚至于还有浮点的运算.所以用到了stm32f ...
- java去除数组重复元素的方法
转载自:https://blog.csdn.net/Solar24/article/details/78672500 import java.util.ArrayList; import java.u ...
- python基础之Day18
一.序列化概念 什么是序列化? 内存中的数据结构转成中间格式(json(所有编程语言通用)和pickle)存储到硬盘或基于网络状态 反序列化: 硬盘网络传来的数据格式转换成内存的数据结构 为什么 1. ...