如何在 RAID 1 上重新对齐 LVM 分区

如何在 RAID 1 上重新对齐 LVM 分区

我在 EFI 系统上安装了 Debian,在 RAID 1 之上使用 LVM,它工作正常,只是 fdisk 给了我警告

# fdisk -l
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 84D87237-49E3-4132-AAAD-C242C572D597

Device       Start        End    Sectors  Size Type
/dev/sda1     2048    1050623    1048576  512M EFI System
/dev/sda2  1050624    1550335     499712  244M Linux RAID
/dev/sda3  1550336 3907028991 3905478656  1.8T Linux RAID


Disk /dev/md1: 1.8 TiB, 1999470854144 bytes, 3905216512 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D797F4C6-B88E-4E57-9D7D-5B323F9CDCA5

Device       Start        End    Sectors  Size Type
/dev/md1p1    4096    1054719    1050624  513M EFI System
/dev/md1p3 1550817 3905216478 3903665662  1.8T Linux LVM

Partition 3 does not start on physical sector boundary.


Disk /dev/md0: 243.8 MiB, 255655936 bytes, 499328 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdb: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 84D87237-49E3-4132-AAAD-C242C572D597

Device       Start        End    Sectors  Size Type
/dev/sdb1     2048    1050623    1048576  512M EFI System
/dev/sdb2  1050624    1550335     499712  244M Linux RAID
/dev/sdb3  1550336 3907028991 3905478656  1.8T Linux RAID


Disk /dev/mapper/Gladys--vg-root: 32 GiB, 34359738368 bytes, 67108864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/Gladys--vg-swap_1: 31.9 GiB, 34183577600 bytes, 66764800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

我找到了一些教程解释如何解决这个问题,但由于 LVM 的原因它不起作用。

那么大家能帮我吗?

答案1

发出警告的原因是,如果您有 4K 驱动器并且分区(和/或其他数据结构(如 LVM 范围))未与 4K 边界对齐,则会出现性能问题。

在我看来,更改现有卷组的对齐方式是不可能的。那么问题是:复制 LVM 数据最不痛苦的方法是什么?

你可以:

  1. 减小 LV 文件系统的大小
  2. 减小 LV 的大小
  3. 减小PV的大小
  4. 减小分区大小(至 10 GiB)
  5. 在可用空间中创建一个新的、正确对齐的分区
  6. 使新分区成为新的PV
  7. 将 VG 扩展到新的 PV
  8. 将所有范围(数据)从旧 PV 移动到新 PV
  9. 从VG中删除旧的PV

或者

  1. 减少一个 LV 文件系统的大小(减少 10 GiB)
  2. 减小 LV 的大小
  3. 减小PV的大小
  4. 减小其分区的大小
  5. 在可用空间中创建一个新的、正确对齐的分区
  6. 将所有 LVM 数据进行文件系统级备份到新分区
  7. 扔掉整个VG和PV
  8. 纠正分区对齐方式
  9. 创建新的PV、VG和LV
  10. 恢复数据
  11. 删除备份分区
  12. 将PV分区扩大到可用空间
  13. 放大PV

相关内容