Union Mount

Docker学习(二十)什么是分层存储? 阅读详情

Union mount

From Wikipedia, the free encyclopedia

In computer operating systems, union mounting is a way of combining multiple directories into one that appears to contain their combined contents.[1] Union mounting is supported in Linux, BSD and several of its successors, and Plan 9, with similar but subtly different behavior.

As an example application of union mounting, consider the need to update the information contained on a CD-ROM or DVD. While a CD-ROM is not writable, one can overlay the CD's mount point with a writable directory in a union mount. Then, updating files in the union directory will cause them to end up in the writable directory, giving the illusion that the CD-ROM's contents have been updated.[1][2]

Implementations

Plan 9

In the Plan 9 operating system from Bell Labs (mid-1980s onward), union mounting is a central concept, replacing several older Unix conventions with union directories; for example, several directories containing executables, unioned together at a single /bin directory, replace the PATH variable for command lookup in the shell.[3]

Plan 9 union semantics are greatly simplified compared to the implementations for POSIX-style operating systems: the union of two directories is simply the concatenation of their contents, so a directory listing of the union may display duplicate names. Also, no effort is made to recursively merge subdirectories, leading to an extremely simple implementation.[4] Directories are unioned in a controllable order; u/name, where u is a union directory, denotes the file called name in the first constituent directory that contains such a file.[4]

Unix and BSD

Unix/POSIX implementations of unions have different requirements from the Plan 9 implementation due to constraints in the traditional Unix file system behavior, which greatly complicates their implementation and often leads to compromises.[5] Problems that union mounting on Unix-like operating systems encounters include:

  • Duplicate file names within a directory are not acceptable, since this would break applications' expectations of how a Unix file system works. Putting a logical, stack-like precedence ordering on the union's constituents partially solves this problem, but requires memory to record which files need to be skipped over during a directory listing (which is otherwise a nearly stateless operation).[5]
  • Deletion requires special support: if files with the same name exists in several of the union directory's constituents, simply deleting it from one of the constituents causes a file from one of the others to reappear in its stead.[5]
  • Insertion of a directory into the stack can cause incoherency in the kernel's file name cache.[5]
  • Renaming a file within a single mounted file system (using the rename system call) should be an atomic operation, but renaming within a union mount can require changes to multiple of the union's constituent directories. A possible solution is to disallow rename in such situations and require implementations to copy-and-delete instead.[2]
  • Stable inode numbers for files, hard links and memory-mapped I/O (mmap) are hard to implement correctly.[2]

Early attempts to add unioning to Unix filesystems included the 3-d filesystem (Bell Labs), the Translucent File Service in SunOS, (Sun Microsystems, 1988[2]) An implementation of union mounting was added to the BSD version of Unix in version 4.4 (1994), taking inspiration from these earlier attempts, Plan 9 and the stackable file systems in Spring (Sun, 1994).[1] 4.4BSD implements the stack-of-directories approach outlined above. Like in Plan 9, operations traverse this stack top-down to resolve names, but unlike in Plan 9, BSD union mounts are recursive, so that the contents of subdirectories appear merged in the union directory. Also unlike in the Plan 9 version, all layers except the top are read-only: modifying files in the union causes their contents to first be copied into the top layer of the stack, where the modifications are then applied. Deletion of files is implemented by writing a special type of file called a whiteout to the top directory, which has the effect of marking the file name as non-existent and hiding files with the same name in the lower layers of the stack.[1] Whiteouts require support from the underlying file system.[4]

Linux

Union mounting was implemented for Linux 0.99 in 1993; this initial implementation was called the Inheriting File System, but was abandoned by its developer because of its complexity.[2] The next major implementation was UnionFS, which grew out of the FiST project at Stony Brook University.[6][5] An attempt to replace UnionFS, aufs, was released in 2006, followed in 2009 by OverlayFS.[2] Only in 2014 was this last union mount implementation added to the standard Linux kernel source code.[7]

Similarly, GlusterFS offers a possibility to mount different filesystems distributed across a network, rather than being located on the same machine.[8]

深入解析Docker镜像分层存储:从rootfs到Union mount的底层实现 本文深入解析了Docker镜像分层存储的底层实现,核心围绕rootfs与Union mount技术展开。通过形象的“透明玻璃板”比喻,阐释了镜像层只读、容器层可写的设计原理,并详细剖析了写时复制(COW)机制如何保障效率与安全。文章还探讨了OverlayFS的实际工作方式,并基于分层原理提供了优化Docker镜像的实用指南。 阅读详情

相关推荐

深入解析Docker镜像分层机制:从rootfs到Union mount的完整实现原理

本文深入解析Docker镜像分层机制,从rootfs的基础概念到Union mount的实现原理,详细介绍了镜像层的只读设计、联合挂载技术及其在容器化实践中的应用。通过实际案例和性能优化建议,帮助开发者更好地理解和使用Docker的分层存储机制,提升容器化部署的效率与安全性。

weixin_29311017的博客 395

linux内核中union,Linux上的Union mount

A union mount显示单个层次结构中多个目录(分支)的组合视图.好的,但我如何在实践中使用一个,哪一个?许多联合装载技术可在现代Linux系统上使用:OverlayFS,aufs,UnionFS,各种基于FUSE的文件系统,……鉴于用例,我如何确定哪一个适合?特别是:>哪些需要在典型系统上进行root访问? (换句话说,非特权用户可以创建联合装载吗?)>哪些可以挂载/(当然有r...

weixin_39604092的博客 392

Docker 镜像读写层核心概念:rootfs、Union mount、image以及layser原理详解

Docker 镜像读写层核心概念:rootfs、Union mount、image以及layser原理详解

大数据开发、JAVA开发、人工智能AI 2763

大前端 -vue - vue3.0 - Composition API

Composition API createApp:创建一个vue对象。 setup: composition api的入口。 reactive: 把一个对象变成响应式对象,并且把该对象的嵌套属性也变成响应式对象。 vue3.0 响应式对象不能解构 案例:获取鼠标位置 import { createApp, reactive } from 'vue' // setup:第一个参数:props // 第二个参数:context,attrs,emit,slots createApp({

weixin_38245947的博客 328

HarmonyOS PC实现Linux工具一键运行的技术解析

操作系统兼容层技术是现代计算环境中的重要创新,它通过动态二进制翻译和共享内核机制实现跨平台运行。这种技术特别适用于需要同时使用不同生态工具的开发者,能显著提升工作效率。以HarmonyOS的轻量化容器引擎为例,其采用Union Mount文件系统设计,既保证了系统安全又支持自由安装软件包。在开发场景中,这种方案相比传统虚拟机启动速度快3倍以上,且支持C/C++、Python等常见开发环境的快速配置。华为云镜像等优化方案进一步提升了软件安装和更新的效率,使得在HarmonyOS上运行Linux工具链变得简单高

weixin_31423955的博客 254

【docker知识】联合文件系统(unionFS)原理

Docker CLI 操作起来比较简单——您只需掌握Create、Run、InspPull和Push容器和图像,但是谁想过Docker 背后的内部机制是如何工作的?在这个简单的表象背后隐藏着许多很酷的技术, UnionFS(统一文件系统)就是其中之一。

gongdiwudu的专栏 6866

用CentOS 7安装cadence搭建适合IC Design的科研环境(四)——IC617、MMSIM151、calibre2015安装过程step by step

以下操作都在root权限下执行。建立安装目录建议把这种大型软件装在/opt目录下。mkdir -p /opt/cadence/installscape mkdir -p /opt/mentor/Calibre2015其中-p参数是直接建立父目录。因为IC617和MMISM151会自己建立安装目录,所以在这里没有建相关目录。而calibre则是默认安装在安装包所在的目录下,所以需要提前建立。解压安

maxwell2ic的博客 7万+

Vue——vue3 生命周期onMounted 和 onUnmounted使用场景

Vue——vue3 生命周期onMounted 和 onUnmounted使用场景

qq_43201350的博客 7133

【新手必看】蓝牙的HOGP和HID、GATT有什么区别和联系

让新手宏观了解蓝牙HOGP、HID、GATT这三个协议的区别和联系

qq_51976334的博客 1565

保姆级教程:用YOLOv5s搞定钢材表面缺陷检测,从数据集NEU-DET到模型部署全流程

本文提供了一份详细的YOLOv5s钢材表面缺陷检测教程,涵盖从NEU-DET数据集处理到模型部署的全流程。针对工业环境中的实际限制,如计算资源有限和标注样本少等问题,提供了优化方案和实用技巧,帮助开发者快速实现高效的钢材缺陷检测系统。

weixin_30568591的博客 464

Docker镜像

本文首发于我的公众号码农之屋(id:Spider1818),专注于干货分享,包含但不限于Java编程、网络技术、Linux内核及实操、容器技术等。欢迎大家关注,二维码文末可以扫。 导读:Image是Docker术语的一种,代表一个只读的layer。而layer则具体代表Docker Container文件系统中可叠加的一部分。 一、前言 据Docker官网描述,Image是Docker...

lsz137105的专栏 280

【COMSOL】将一个面上数据导出CSV或txt格式的方法

在COMSOL中参数化扫描后,把一个面上或体里的数据按照CSV或TXT格式导出的方法。

dave496206的博客 2989

rclone 云存储同步完整教程:40+ 网盘备份、迁移、挂载一次学会

rclone 是一个命令行云存储同步工具,官方定位是 "rsync for cloud storage"。它把 Google Drive、OneDrive、S3、Dropbox 等 40 多种网盘接入成统一接口,一条命令就能完成备份、同步与迁移,不依赖任何图形客户端。 [![rclone 云存储同步工具标识](https://raw.gitcode.com/GitHub_Trending/rc/

gitblog_01198的博客 649

手把手教你学RDMA驱动开发专栏--第7章 队列对(QP)与数据传输实现​7.3 完成队列(CQ):事件通知机制与轮询/中断模式

本章详细探讨了RDMA驱动中完成队列(CQ)的事件通知机制,重点分析了轮询与中断两种模式的实现原理及优化策略。CQ作为操作结果的报告载体,其核心功能包括结果反馈、事件通知和资源同步。轮询模式通过主动查询实现低延迟,适合高性能场景;中断模式通过被动通知节省CPU资源,适用于低频事件处理。驱动实现需考虑CQ溢出防护、多QP共享同步等关键问题,并提供事件通道机制将CQE传递给用户态。通过对比两种模式的优缺点及适用场景,揭示了RDMA系统在性能与资源间的权衡机制。

MHD0815的博客 396

17、扩展景深成像的瞳孔函数工程技术解析

本文详细解析了扩展景深成像的关键技术,包括基于焦距堆栈的数字处理方法、立方相位掩模的光学设计、对数非球面透镜的应用以及旋转点扩散函数的深度编码功能。通过实验验证和实际应用分析,展示了这些技术在显微镜成像、工业检测和医疗影像中的广泛用途及优势。同时探讨了未来发展方向,如智能算法优化、新型光学材料和多模态成像技术,为相关领域的技术创新提供了参考。

y2z3a4b5c的博客 168

Docker入门实战(三)-Docker容器镜像

1 Docker架构和底层技术简介 2 Docker Image概述 从基本的看起,一个典型的 Linux 文件系统由 bootfs 和 rootfs 两部分组成, bootfs(boot file system) 主要包含 bootloader 和 kernel,bootloader 主要用于引导加载 kernel,当 kernel 被加载到内存中后 bootfs 会被 umount 掉 rootfs (root file system) 包含的就是典型 Linux 系统中的/dev,/

JavaEdge全是干货的技术号 1758

图像处理:张量分解在图像处理领域的应用

随着计算机视觉和图像处理技术的快速发展,图像数据呈现出高维、多模态、海量等特点。传统的矩阵分解方法已经无法有效处理这些复杂的图像数据。张量分解作为一种高阶矩阵分解方法,可以很好地捕捉图像数据的高维结构信息,在图像处理领域展现出巨大的应用前景。本节介绍几种常用的张量分解算法,包括高阶SVD(HOSVD)、Tucker-ALS、CP-ALS等。这些算法的核心思想是通过迭代优化的方式,交替更新张量分解的因子矩阵,直到收敛为止。综上所述,本文系统地介绍了张量分解技术在图像处理领域的应用。

AI天才研究院 7103

Docker镜像和卷原理

操作系统由进程调度子系统,进程通信子系统,内存管理子系统,设备管理子系统,文件管理子系统,网络通信子系统和作业控制子系统组成。Linux的文件管理子系统由bootfs和rootfs组成。

2301_79127392的博客 410

【MATLAB】通过计算曲率和曲率变化率来实现对曲线波浪程度

这段代码将计算给定曲线的曲率,并与给定阈值进行比较以检测拐角。函数是MATLAB中一个常用的函数,可以用于计算曲线在每个点处的曲率。它基于一种被称为“local least squares fitting” 的方法,通过拟合每个点周围的一小段曲线来计算曲率。MATLAB中可以使用多种方法实现拐角检测,其中一种方法是基于曲率半径的算法。该算法通过计算曲线上每个点处的曲率半径,找到拐角和弯曲处。是一个可选参数,用于控制拟合曲线的平滑度,取值范围为0到1,越接近1表示曲线越平滑。表示曲线在每个点处的曲率,

Fanjufei的博客 1918

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

30分钟玩转Docker系列课程2---Docker核心概念

对于学习Docker而言,很关键的一点,一定要了解Docker的核心概念及其原理,若不了解清除,在后续的可持续集成,自动化生产部署方案会出现问题 Docker原理: Docker 使用客户端-服务器(C/S) 架构模式。Docker 客户端会与 Docker 守护进程进行通信。Docker 守护进程会处理复杂繁重的任务,例如建立、运行、发布你的 Docker 容器。Dock

tigereg000的博客 675

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

docker镜像分层特点

我们知道,docker镜像都是分层的,从我们pull下来的过程就知道这个现象,现在有这么一个Dockerfile文件 FROM centos:7 RUN yum install net-tools-y RUN yum install httpd -y RUN yum install elink -y CMD ["/bin/bash"] 它的分层图如下: 分层的好处在于共享资源,比如说有很多的镜像,可以从base镜像构建而来,那么docker host当中只需要在硬盘上保存一份base镜像即可,

leechm的博客 934

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

rclone 云存储同步实战手册:从一次迁移到定时备份

rclone 是一个云存储同步的命令行工具,自称"rsync for cloud storage",能接入 Google Drive、Amazon S3、OneDrive 等 40 多种存储服务。一套命令就能把"把文件搬上云、每天自动备份、把云盘挂成本地目录"这几件麻烦事全办掉。 ## 用一条命令统一 40 多种存储 你是否遇到过这种情况:照片在 Drive,代码备份在 S3,视频在 OneD

gitblog_00099的博客 203

rclone 快速入门:3 步完成首次云同步与自动备份的完整指南

文件散落在 Google Drive、OneDrive、S3 和服务器磁盘里,想备份要登三个网页,想迁移只能下载再上传。rclone 是"云存储版的 rsync",一个命令行工具覆盖 60 多种网盘与对象存储,同步、备份、迁移一条命令搞定。 ## 为什么是 rclone 你不需要在每家网盘的网页后台之间来回切换,也不需要为每个平台记一套接口。装一次 rclone,所有网盘都用同一套命令操作。

gitblog_00274的博客 250

docker研习-基础技术:Linux Namespace、Linux Cgroups与分层文件系统

深入学习!手撕docker!我们常听说docker是一个基于linux namespace和linux cgroups的虚拟化工具,下文将介绍docker依赖的linux namespace 和 linux cgroups是什么技术。

Donnnn_的博客 352

手写Docker之认识NameSpace、CGroups、Union file system

文章系列均基于《手写Docker》作为记录

qq_51898139的博客 752
上一篇: Docker Machine
下一篇: Best Practices for Writing Dockerfiles
screaming
博客等级 码龄19年 60粉丝 6原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值