# 逻辑卷管理器（Linux）

逻辑卷管理器（LVM）是 [Linux 内核](https://www.edgepedia.org/zh/linux-kernel)的标准卷管理器：它由一组用户空间工具和一个内核层组成，从物理磁盘池中创建称为逻辑卷的虚拟块设备。逻辑卷可以独立于底层磁盘布局进行调整大小、移动、条带化、镜像、创建快照、精简置备或缓存，这些能力是传统固定分区所不具备的。<sup>[1](https://man7.org/linux/man-pages/man8/lvm.8.html)</sup><sup> • </sup><sup>[2](https://ubuntu.com/server/docs/explanation/storage/about-lvm/)</sup>

| 关键事实 | 详情 |
|---|---|
| 抽象层 | 物理卷（PV，整块磁盘或分区）被组合成卷组（VG），再从卷组中分配逻辑卷（LV）；逻辑卷通常承载一个文件系统，并且可以跨多块磁盘而不必物理连续<sup>[2](https://ubuntu.com/server/docs/explanation/storage/about-lvm/)</sup> |
| 内核机制 | 逻辑卷中的数据放置由内核中的设备映射器（Device Mapper，DM）实现；由 LVM2 用户空间工具集驱动<sup>[1](https://man7.org/linux/man-pages/man8/lvm.8.html)</sup><sup> • </sup><sup>[3](https://sourceware.org/lvm2/)</sup> |
| 段类型 | 线性、条带化、镜像、RAID、精简置备、缓存、快照和 VDO 卷；这些类型可按受支持的组合叠加<sup>[4](https://access.redhat.com/articles/2106521)</sup> |
| 精简置备 | 精简逻辑卷的块在写入时从精简池中分配，因此其虚拟大小可远超物理空间；该池由数据逻辑卷（`_tdata`）和元数据逻辑卷（`_tmeta`）组成，并由 `dm_thin_pool` 内核模块管理<sup>[5](https://man7.org/linux/man-pages/man7/lvmthin.7.html)</sup> |
| 快照 | 写时复制快照捕获卷在某一时间点的状态；精简快照与源卷共享数据块，因此同一源卷的许多快照只会增加很少的磁盘占用<sup>[6](https://docs.kernel.org/6.10/admin-guide/device-mapper/snapshot.html)</sup><sup> • </sup><sup>[7](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html-single/logical_volume_manager_administration/index)</sup> |
| 缓存 | 自 RHEL 7.1 起，LVM 可将 SSD 等快速设备用作更大、更慢设备的回写或直写缓存<sup>[7](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html-single/logical_volume_manager_administration/index)</sup> |
| 历史 | 最初的 LVM 由海因茨·毛尔沙根（Heinz Mauelshagen）编写（版权 1997，西斯蒂娜软件（Sistina Software））；LVM 1 随 2.4 内核系列发布，LVM 2 使用 2.6 内核的设备映射器驱动<sup>[8](https://kernel.googlesource.com/pub/scm/linux/kernel/git/wtarreau/linux-2.4/%2B/refs/heads/master/include/linux/lvm.h)</sup><sup> • </sup><sup>[9](https://linux.die.net/HOWTO/LVM-HOWTO/whatislvm.html)</sup> |
| 当前版本 | LVM2 用户空间工具以 2.03.x 源码包形式发布；版本 2.03.33 的日期为 2025 年 6 月 27 日<sup>[3](https://sourceware.org/lvm2/)</sup><sup> • </sup><sup>[10](https://mirrors.kernel.org/sourceware/lvm2/)</sup> |

## 三层如何工作

LVM 管理三个概念。物理卷对应磁盘或磁盘分区，构成最低的抽象层。卷组是物理卷的集合，充当可分配磁盘空间的池。在系统和应用看来，逻辑卷相当于分区，但与分区不同，它们可以跨多块磁盘，且不必物理连续。<sup>[2](https://ubuntu.com/server/docs/explanation/storage/about-lvm/)</sup>

逻辑卷中的每个数据块，按照内核中设备映射器实现的算法，存储在其卷组的一块或多块物理卷上。<sup>[1](https://man7.org/linux/man-pages/man8/lvm.8.html)</sup> 设备映射器提供各个映射目标，包括线性、条带、镜像、RAID、缓存、精简置备、快照、crypt、integrity 和 verity 目标，LVM 将其组装成卷栈。<sup>[11](https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/index.html)</sup>

由于分配与硬件解耦，只要其上的文件系统也支持在线扩容，逻辑卷就可以在挂载状态下扩展，新空间可以来自卷组中的任何位置，甚至另一块磁盘。<sup>[12](https://ubuntu.com/server/docs/_/downloads/en/latest/pdf/)</sup> 卷组的元数据备份在 `/etc/lvm/backup/` 中，归档版本位于 `/etc/lvm/archive/`。<sup>[13](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/epub/configuring_and_managing_logical_volumes/index)</sup>

## 精简置备

在标准逻辑卷中，块在创建逻辑卷时从卷组中分配。在精简逻辑卷中，块在写入时从特殊的精简池逻辑卷中分配，因此精简逻辑卷的虚拟大小可以远大于其背后的物理存储，并且池可在需求上升后扩展。<sup>[5](https://man7.org/linux/man-pages/man7/lvmthin.7.html)</sup> 精简池本身由两个隐藏的组件逻辑卷构成：一个带 `_tdata` 后缀的数据逻辑卷，以及一个带 `_tmeta` 后缀的元数据逻辑卷；后者由 `dm_thin_pool` 内核模块用来跟踪哪些数据块属于哪个精简逻辑卷。<sup>[5](https://man7.org/linux/man-pages/man7/lvmthin.7.html)</sup>

**精简卷上的快照成本很低。** 精简快照最初引用与源卷相同的数据块，而一个精简逻辑卷与其任意快照（包括快照的快照这类递归快照）共有的块都在池中共享；文中未说明快照序列存在上限或性能退化。<sup>[5](https://man7.org/linux/man-pages/man7/lvmthin.7.html)</sup> 红帽（Red Hat）的管理指南列出了同样的优点：同一源卷的多个快照可减少磁盘占用；无论快照数量多少，每次源卷写入只进行一次写时复制操作；并且可以把一个精简快照用作另一个快照的源卷。<sup>[7](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html-single/logical_volume_manager_administration/index)</sup>

**精简池被写满是主要风险。** 如果池的数据空间或元数据空间耗尽，写入就会失败；这种错误模式可能损坏文件系统，使其需要修复，而元数据耗尽会使池元数据和文件系统都处于不一致状态，需要用 `lvconvert --repair` 进行离线修复，随后再做文件系统检查。<sup>[5](https://man7.org/linux/man-pages/man7/lvmthin.7.html)</sup> 因此 LVM 支持自动扩展：通常由 `lvm2-monitor` 服务启动的 `dmeventd` 守护进程会在池空间不足时接收内核通知，并运行 `lvextend --use-policies`，其行为由 `lvm.conf` 中的 `thin_pool_autoextend_threshold`（最小 50；100 表示禁用自动扩展）和 `thin_pool_autoextend_percent` 设置控制。<sup>[5](https://www.man7.org/linux/man-pages/man7/lvmthin.7.html)</sup> 红帽的指导很直白：精简池被完全耗尽可能导致数据丢失，因此管理员必须监控可用空间。<sup>[14](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/pdf/storage_administration_guide/storage-administration-guide.pdf)</sup>

删除精简逻辑卷上文件系统内的文件，本身不会把空间归还给池，因为文件系统通常不会以 discard 选项挂载。手动运行 `fstrim` 会把释放的块归还给池；在手册页的示例中，一个承载 100 GB 精简逻辑卷的 10 GB 池，会因一个 1 GB 文件而损失 10% 的池空间，只有在该文件被删除后运行 `fstrim`，才能恢复这 10% 的物理空间。<sup>[5](https://man7.org/linux/man-pages/man7/lvmthin.7.html)</sup>

## 快照：旧式与精简

经典的设备映射器快照只把发生更改的块复制到单独的写时复制（COW）设备，使快照的可见内容保持不变，而源卷继续变化；同一套机制还可以把快照合并回其源卷。<sup>[6](https://docs.kernel.org/6.10/admin-guide/device-mapper/snapshot.html)</sup> 红帽将这些旧式快照描述为适合短期使用，例如做一次备份然后删除快照；当快照很大或数量很多时性能较差，并建议长期或大规模使用精简快照。<sup>[4](https://access.redhat.com/articles/2106521)</sup> 有两种情况仍然更适合旧式快照：它们允许更小的块大小，而且其大小可以被限制；而精简快照的大小无法设上限，除非它是其池中唯一的快照。<sup>[4](https://access.redhat.com/articles/2106521)</sup><sup> • </sup><sup>[7](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html-single/logical_volume_manager_administration/index)</sup>

## RAID、镜像与叠加

LVM 卷可以是线性、条带化、镜像或 RAID，这些类型可以叠加：池和缓存数据可以位于除快照和镜像之外的任何基础类型之上，并且可以对大多数类型创建精简快照。<sup>[4](https://access.redhat.com/articles/2106521)</sup> 红帽的支持政策在这种灵活性中划出了实际区别。镜像在现有用例中仍受支持，尤其是在集群中的共享激活（RAID 无法以共享模式激活）以及内部使用镜像的 `pvmove` 中；但红帽不把支持范围扩展到叠加在镜像之上的设备。<sup>[4](https://access.redhat.com/articles/2106521)</sup> 条带的镜像（`lvcreate -m N -i M`）被认为不是最优，因为单块驱动器故障会丢失整个条带；建议改用 RAID10。<sup>[4](https://access.redhat.com/articles/2106521)</sup> 在集群环境中，精简置备卷仅在主备（active/passive）配置中受支持；在弹性存储附加组件（Resilient Storage Add-On）中，缓存卷不支持与 `lvmlockd` 或 `clvmd` 一起使用。<sup>[15](https://access.redhat.com/articles/3071171)</sup>

## 历史

最初的 Linux LVM 由海因茨·毛尔沙根编写；内核头文件 `lvm.h` 带有 1997 至 2002 年的版权声明，署名他和西斯蒂娜软件；他于 1999 年 2 月在 Linux 内核邮件列表上宣布了项目的 `linux-lvm` 邮件列表。<sup>[8](https://kernel.googlesource.com/pub/scm/linux/kernel/git/wtarreau/linux-2.4/%2B/refs/heads/master/include/linux/lvm.h)</sup><sup> • </sup><sup>[16](https://lwn.net/1999/0218/a/lvm.html)</sup> 0.7 版于 1999 年 7 月推出，除其他特性外，增加了对把根文件系统放在逻辑卷中以及最大 512 KB 条带大小的支持。<sup>[17](https://lwn.net/1999/0722/a/lvm.html)</sup> 毛尔沙根 1998 年的一篇会议论文把 LVM 与在线文件系统调整大小相结合、以及在 LVM 内实现 RAID 1/5/10/50 列为未来工作，这些方向后来由后续版本继续推进。<sup>[18](https://neilrieck.net/misc/pdf/computer-docs/LVM-paper-1998.PDF)</sup>

随后出现了两代。LVM 1 的内核驱动被纳入 2.4 系列内核，除缺陷修复外已不再开发。当前版本 LVM 2 使用随 2.6 内核树引入的设备映射器内核驱动，并且几乎完全向后兼容 LVM 1 卷，例外是快照卷必须在升级前删除。<sup>[9](https://linux.die.net/HOWTO/LVM-HOWTO/whatislvm.html)</sup> LVM2 现在是 Linux 上提供逻辑卷管理功能的用户空间工具集，源码版本通过 sourceware 发布。<sup>[3](https://sourceware.org/lvm2/)</sup>

## LVM 与 ZFS、普通 RAID 的比较

比较通常为这三种技术分配不同的用途：硬件 RAID 或 `mdadm` RAID 提供磁盘冗余，LVM 提供卷管理，ZFS 提供集成的卷管理器加文件系统。<sup>[19](https://computingforgeeks.com/raid-vs-lvm-vs-zfs-comparison/)</sup> ZFS 将文件系统、卷管理、RAID 和加密整合在一个软件包中，而 LVM 提供块设备，由管理员在其上选择 ext4 或 XFS 等文件系统；因此 LVM 被描述为轻量级卷管理器，而 ZFS 是具有高级数据完整性功能的集成文件系统与卷管理器。<sup>[20](https://www.thelinuxvault.net/linux-io-storage-management/comparing-lvm-and-zfs-on-linux-which-to-choose/)</sup>

## References

1. [lvm(8) — Linux manual page](https://man7.org/linux/man-pages/man8/lvm.8.html)
2. [About Logical Volume Management (LVM), Ubuntu Server documentation](https://ubuntu.com/server/docs/explanation/storage/about-lvm/)
3. [LVM2 Resource Page, sourceware.org](https://sourceware.org/lvm2/)
4. [Stacking LVM volumes, Red Hat Customer Portal](https://access.redhat.com/articles/2106521)
5. [lvmthin(7) — Linux manual page](https://man7.org/linux/man-pages/man7/lvmthin.7.html)
6. [Device-mapper snapshot support, The Linux Kernel documentation](https://docs.kernel.org/6.10/admin-guide/device-mapper/snapshot.html)
7. [Logical Volume Manager Administration, Red Hat Enterprise Linux 7](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html-single/logical_volume_manager_administration/index)
8. [include/linux/lvm.h, Linux 2.4 source tree](https://kernel.googlesource.com/pub/scm/linux/kernel/git/wtarreau/linux-2.4/%2B/refs/heads/master/include/linux/lvm.h)
9. [What is LVM?, LVM HOWTO](https://linux.die.net/HOWTO/LVM-HOWTO/whatislvm.html)
10. [Index of /sourceware/lvm2/, kernel.org mirror](https://mirrors.kernel.org/sourceware/lvm2/)
11. [Device Mapper, The Linux Kernel documentation](https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/index.html)
12. [Ubuntu Server Guide (PDF), About LVM](https://ubuntu.com/server/docs/_/downloads/en/latest/pdf/)
13. [Configuring and managing logical volumes, Red Hat Enterprise Linux 8](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/epub/configuring_and_managing_logical_volumes/index)
14. [Storage Administration Guide, Red Hat Enterprise Linux 7 (PDF)](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/pdf/storage_administration_guide/storage-administration-guide.pdf)
15. [Support Policies for RHEL High Availability Clusters — LVM in a Cluster, Red Hat Customer Portal](https://access.redhat.com/articles/3071171)
16. [linux-lvm mailing list announcement, LWN.net, 13 February 1999](https://lwn.net/1999/0218/a/lvm.html)
17. [LVM 0.7 announcement, LWN.net, 18 July 1999](https://lwn.net/1999/0722/a/lvm.html)
18. [Heinz Mauelshagen, LVM paper (28 May 1998)](https://neilrieck.net/misc/pdf/computer-docs/LVM-paper-1998.PDF)
19. [RAID vs LVM vs ZFS: Which Linux Storage to Choose?, ComputingForGeeks](https://computingforgeeks.com/raid-vs-lvm-vs-zfs-comparison/)
20. [Comparing LVM and ZFS on Linux: Which to Choose?, The Linux Vault](https://www.thelinuxvault.net/linux-io-storage-management/comparing-lvm-and-zfs-on-linux-which-to-choose/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Operating systems › Unix-like and Linux › Unix, BSD, and kernel internals

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/logical-volume-manager-linux

English original: https://www.edgepedia.org/logical-volume-manager-linux
