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) 开始的. ...
随机推荐
- Python-cookie,session
前言: 其实cookie这个词对于我们并不陌生,经常就听见说网页加载慢了,清理一下浏览器的缓存和cookie,cookie就是一个特殊数据验证类型,一般存储在客户端的浏览器上面,比如我们登录某宝后,下 ...
- Java框架spring 学习笔记(十三):log4j介绍
功能 日志功能,通过log4j可以看到程序运行过程的详细信息. 使用 导入log4j的jar包 复制log4j的配置文件,复制到src下面 3.设置日志级别 info:看到基本信息 debug:看 ...
- ES6学习笔记(数组)
1.扩展运算符:, 2, 3]) // 1 2 3 console.log(1, ...[2, 3, 4], 5) // 1 2 3 4 5 用于函数调用 function add(x, y) { r ...
- Centos 7 配置邮件发送
一.环境 系统:centos 7 sendmail:sendmail.x86_64 0:8.14.7-5.el7 mailx版本:mailx-12.5-19.el7.x86_64 二.软件安装: 1. ...
- 20175126《Java程序设计》第四周学习总结
# 20175126 2016-2017-2 <Java程序设计>第四周学习总结 ## 教材学习内容总结 - 本周学习方式主要为手动敲打教材代码和观看APP上的视频资源自学. - 学习内容 ...
- 监听端口,获取webService请求报文
第一步下载我们的wsdl文件到本地 第二步建立一个测试webservice工程,把wsdl放在项目里面 第三步把测试webservice中的wsdlLocation改成localhost.....你的 ...
- Java并发编程:深入剖析ThreadLocal(转)
目录大纲: 一.对ThreadLocal的理解 二.深入解析ThreadLocal类 三.ThreadLocal的应用场景 原文链接:http://www.cnblogs.com/dolphin052 ...
- 部署代码review和CI
公司原先搭了一个代码Review的服务器,由于历史原因,装的是一个32bit的Ubuntu系统,后来由于需要,需要安装gitlab,由于gitlab需要64位系统,所以临时凑合了个vagrant,本质 ...
- 安装Pygame(Python3.6,windows)
1. 本机为python3.6的环境 2. 到pygame官网下载对应系统,对应python版本的pygame文件,下载地址:https://pypi.python.org/pypi/Pygame/1 ...
- 多个表左联,要返回全部的结果,解决不能用where的问题
qb.leftJoin('info_student', 'grouping_class_student.studentId', 'info_student.id'); qb.leftJoin('gro ...