<feed xmlns="http://www.w3.org/2005/Atom"> <id>https://divedb.github.io/</id><title>divedb</title><subtitle>A minimal, responsive and feature-rich Jekyll theme for technical writing.</subtitle> <updated>2025-08-07T15:20:14+00:00</updated> <author> <name>NINE</name> <uri>https://divedb.github.io/</uri> </author><link rel="self" type="application/atom+xml" href="https://divedb.github.io/feed.xml"/><link rel="alternate" type="text/html" hreflang="en" href="https://divedb.github.io/"/> <generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator> <rights> © 2025 NINE </rights> <icon>/assets/img/favicons/favicon.ico</icon> <logo>/assets/img/favicons/favicon-96x96.png</logo> <entry><title>proc文件系统</title><link href="https://divedb.github.io/posts/proc%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F/" rel="alternate" type="text/html" title="proc文件系统" /><published>2025-08-07T00:00:00+00:00</published> <updated>2025-08-07T00:00:00+00:00</updated> <id>https://divedb.github.io/posts/proc%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F/</id> <content type="text/html" src="https://divedb.github.io/posts/proc%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F/" /> <author> <name>NINE</name> </author> <category term="proc" /> <summary>/proc/self/exe 是 Linux 系统中一个特殊的符号链接，它指向 当前进程的可执行文件 的绝对路径。这个机制在多种场景下非常有用，以下是它的主要用法和示例： 1. 获取当前程序的绝对路径 最常见的用途是 动态获取当前运行程序的完整路径，无需硬编码路径或依赖 argv[0]（可能不准确）。 C 语言示例 c #include &amp;lt;unistd.h&amp;gt; #include &amp;lt;stdio.h&amp;gt; int main() { char exe_path[1024]; ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1); if (len != -1) { exe_path[len] = '\0'; pr...</summary> </entry> <entry><title>mount</title><link href="https://divedb.github.io/posts/mount/" rel="alternate" type="text/html" title="mount" /><published>2025-08-07T00:00:00+00:00</published> <updated>2025-08-07T00:00:00+00:00</updated> <id>https://divedb.github.io/posts/mount/</id> <content type="text/html" src="https://divedb.github.io/posts/mount/" /> <author> <name>NINE</name> </author> <category term="mount" /> <summary>Linux中的mount命令用于将文件系统挂载到目录树的指定位置，使存储设备（如硬盘、分区、网络存储等）的内容可访问。以下是mount的核心概念、常用参数及示例： 🧱 1 基本语法 mount [-选项] [设备] [挂载点] 设备：如/dev/sda1、UUID=xxxx、网络路径（NFS/CIFS）。 挂载点：必须是一个已存在的目录。 🧰 2 常用挂载参数 通用选项 参数 作用 -t &amp;lt;文件系统类型&amp;gt; 指定文件系统类型（如ext4、xfs、nfs、vfat、tmpfs）。 -o &amp;lt;选项&amp;gt; 挂载选项（多个选项用逗号分隔），详见下文。 -a 挂载/et...</summary> </entry> <entry><title>losetup命令</title><link href="https://divedb.github.io/posts/losetup%E5%91%BD%E4%BB%A4/" rel="alternate" type="text/html" title="losetup命令" /><published>2025-08-07T00:00:00+00:00</published> <updated>2025-08-07T00:00:00+00:00</updated> <id>https://divedb.github.io/posts/losetup%E5%91%BD%E4%BB%A4/</id> <content type="text/html" src="https://divedb.github.io/posts/losetup%E5%91%BD%E4%BB%A4/" /> <author> <name>NINE</name> </author> <category term="Linux" /> <summary>🧩 概要 losetup是Linux系统中用于管理loop设备的命令行工具。loop设备是一种虚拟块设备，允许将普通文件“映射”为块设备，从而可以对文件进行像对磁盘分区那样的操作。losetup负责将一个普通文件绑定到一个loop设备，或者解除绑定。 💡 loop设备简介 Linux中的块设备（block device）通常是物理硬盘、SSD、U盘等。 loop设备将普通文件当作虚拟磁盘，内核会把对loop设备的读写请求转发到该文件的相应偏移处。 这样，普通文件就可以被格式化、挂载、写入数据等，类似真实硬盘。 ⚙️ 常见应用场景 使用Snap包管理器挂载.snap文件。 测试和开发需要块设备的应用。 结合LVM或RAID技术创建虚拟磁盘阵列。 🧰 常用命令示例 ✨ 创建一个100MB的空文件，作为虚拟磁盘镜像 $ dd if=/dev/...</summary> </entry> <entry><title>runc基本实验</title><link href="https://divedb.github.io/posts/runc%E5%9F%BA%E6%9C%AC%E5%AE%9E%E9%AA%8C/" rel="alternate" type="text/html" title="runc基本实验" /><published>2025-08-06T00:00:00+00:00</published> <updated>2025-08-06T00:00:00+00:00</updated> <id>https://divedb.github.io/posts/runc%E5%9F%BA%E6%9C%AC%E5%AE%9E%E9%AA%8C/</id> <content type="text/html" src="https://divedb.github.io/posts/runc%E5%9F%BA%E6%9C%AC%E5%AE%9E%E9%AA%8C/" /> <author> <name>NINE</name> </author> <category term="容器虚拟化" /> <summary>手动使用runc来运行一个容器。 ✅ 1. 准备基本环境 确保已经有： 已安装的runc（从GitHub编译或通过包管理器） 一个root权限的shell（比如使用 sudo） ✅ 2. 准备一个rootfs 容器启动需要一个根文件系统（rootfs），可以用busybox来构造一个轻量的rootfs。 使用BusyBox构造最小rootfs $ mkdir ~/mycontainer $ cd ~/mycontainer # 下载并解压busybox静态构建版本 $ wget https://busybox.net/downloads/binaries/1.36.0-i686-uclibc/busybox $ chmod +x busybox $ mkdir -p rootfs/bin $ cp busybox rootfs/bin/ 然后创建必要的...</summary> </entry> <entry><title>虚拟地址转换[五] - paging structure caches</title><link href="https://divedb.github.io/posts/%E8%99%9A%E6%8B%9F%E5%9C%B0%E5%9D%80%E8%BD%AC%E6%8D%A2-%E4%BA%94-paging-structure-caches/" rel="alternate" type="text/html" title="虚拟地址转换[五] - paging structure caches" /><published>2025-08-03T00:00:00+00:00</published> <updated>2025-08-03T00:00:00+00:00</updated> <id>https://divedb.github.io/posts/%E8%99%9A%E6%8B%9F%E5%9C%B0%E5%9D%80%E8%BD%AC%E6%8D%A2-%E4%BA%94-paging-structure-caches/</id> <content type="text/html" src="https://divedb.github.io/posts/%E8%99%9A%E6%8B%9F%E5%9C%B0%E5%9D%80%E8%BD%AC%E6%8D%A2-%E4%BA%94-paging-structure-caches/" /> <author> <name>NINE</name> </author> <category term="Linux" /> <summary>回顾上文TLB entry和PTE entry的组成，你有没有意识到，在多级页表系统中，TLB其实只是最后一级PTE的缓存（对于large pages的TLB则最后一级是PDE或者PDPTE，本文以下的讨论都是针对非large page的情况），这和在单级页表中是一样的。 多级页表的查找是一个串行的，链式的过程。试想一下，访问在虚拟地址空间里连续的两个pages（比如虚拟地址分别为0x0000123456789000和0x000012345678A000），而这两个pages的PGD entry, PUD entry, PMD entry都是一样的，只有PTE不一样。 难道在通过N次内存访问查找到第一个page的物理页面号后，在访问相邻的（虚拟地址层面）第二个page时还需要再老老实实，一步一步的从PGD往下找？这对于在追求性能方面可谓无所不用其极的现代处理器来说，是不可接受的。...</summary> </entry> </feed>
