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) 开始的. ...
随机推荐
- c++ 使用模板按类型统计stl多维容器中元素的数量
struct ItemCounter{template<typename T1, typename T2, typename = typename std::enable_if<!std: ...
- redis 开机启动
使用chkconfig开机启动redis. 把redis初始脚本拷贝到/etc/init.d/下面. #cd /usr/local/redis/redis-2.6.16/utils # cp redi ...
- day49 定位布局和过渡动画
复习 1.盒子在父级水平居中 margin: 0 auto; 2.文本样式操作 color: red; text-align: center; font: 900 30px/200px "S ...
- C#移动及改变控件大小
//代码比较简单,就不多解析了. #region 移动窗体保存数据 Point mouseOff;//鼠标移动位置变量 bool leftFlag; //标志是否为左键 bool largeFlag; ...
- 《Orange‘s》FAT12文件系统
FAT12 层次 扇区(Sector):磁盘上的最小数据单元 簇(Cluster):一个或多个扇区 分区(Partition):通常指整个文件系统 引导扇区 引导扇区是整块软盘的第0个扇区,在这个扇区 ...
- 《Orange‘s》 Bochs环境配置
安装配置bochs之前先写一个简单的引导扇区用来测试: org 07c00h mov ax,cs mov ds,ax mov es,ax call DispStr jmp $ DispStr: mov ...
- jumpserver笔记
一.安装docker使用官方脚本自动安装 curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun 二.拉取jumperse ...
- unity插件各领域王者
移动端手势操作 Easy Touch 获取 缓动 iTween 获取 可视化编程 Playmaker1.9.0 获取 UI NGUI,UGUI 获取 Shader着色器可视化编程 AmplifySha ...
- JS判断一个数组中有无重复元素(数字)
前段时间遇到了这个问题 也百度了很多 不过还是用自己的方法解决了 一个超级简单的方法 简单到令人发指 由于直接写文本太丑了 所以还是截图吧 嘻嘻嘻 假如有一个这样的数组 (这是假如 可能每个人的数据 ...
- intel xeon家族介绍
Xeon - Intel < intel Xeon Past and current logos Developer Intel Manufacturer Intel Typ ...