第 3 章 LVM 组成


本章论述了 LVM 逻辑卷的组成。

3.1. 物理卷

LVM 逻辑卷的基本物理存储单元是块设备,比如分区或者整个磁盘。这个设备是作为 LVM 物理卷(PV)进行初始化的。将块设备作为物理卷进行初始化会在接近设备起始处放置一个标签。
默认情况下,LVM 标签是放在第二个 512 字节扇区。您可以将标签放在最开始的四个扇区之一来覆盖这个默认设置。这样就允许在必要时 LVM 卷可与其它使用这些扇区的用户共同存在。
LVM 标签可为物理设备提供正确的识别和设备排序,因为在引导系统时,设备可以任何顺序出现。LVM 标记在重新引导和整个群集中保持不变。
LVM 标记可识别作为 LVM 物理卷的设备。它为物理卷包含一个随机特定识别符号(UUID)。它还用字节记录块设备的大小,并记录 LVM 元数据在设备中的存储位置。
LVM 元数据包含您的系统中 LVM 卷组的配置详情。在默认情况下,在卷组中的每个物理卷中都会在其元数据区域保留一个一样的副本。LVM 元数据很小,并可以 ASCII 格式保存。
现在,LVM 允许您在每个物理卷中保存 0、1 或者 2 个元数据副本。默认是保存一个副本。一旦您设置了在物理卷中保存的元数据备份数目之后就无法再更改了。第一个副本保存在设备的起始位置,紧挨着标签。如果有第二个副本,会将其放在设备的末尾。如果您不小心写入了不同于您想要写入的磁盘从而覆盖了磁盘的起始部分,那么您可以使用在设备末尾的元数据第二个副本可让进行恢复。
For detailed information about the LVM metadata and changing the metadata parameters, see 附录 E, LVM 卷组元数据.

3.1.1. LVM Physical Volume Layout

图 3.1 “物理卷布局” shows the layout of an LVM physical volume. The LVM label is on the second sector, followed by the metadata area, followed by the usable space on the device.

注意

在 Linux 内核(在整个文档中),每个扇区的大小为 512K。

图 3.1. 物理卷布局

3.1.2. 一个磁盘中有多个分区

LVM 允许您在磁盘分区外创建物理卷。通常建议您创建可覆盖整个磁盘的单一分区,并将其标记为 LVM 物理卷,理由如下:
  • 方便管理
    如果每个正真的磁盘只出现一次会比较容易在系统中追踪硬件,这在磁盘失败时尤为突出。另外,单一磁盘中有多个物理卷可导致内核在引导时发出未知分区类型警告。
  • 条带性能
    LVM cannot tell that two physical volumes are on the same physical disk. If you create a striped logical volume when two physical volumes are on the same physical disk, the stripes could be on different partitions on the same disk. This would result in a decrease in performance rather than an increase.
Although it is not recommended, there may be specific circumstances when you will need to divide a disk into separate LVM physical volumes. For example, on a system with few disks it may be necessary to move data around partitions when you are migrating an existing system to LVM volumes. Additionally, if you have a very large disk and want to have more than one volume group for administrative purposes then it is necessary to partition the disk. If you do have a disk with more than one partition and both of those partitions are in the same volume group, take care to specify which partitions are to be included in a logical volume when creating striped volumes.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat