当我试图为 / 文件系统扩展我的 lvm 时,我犯了一个错误。而且我不确定这是否也是一个错误。
我没有创建新分区并将其添加到 pv、vg 并随后扩展 lv,而是从当前分区的命令“pvresize”开始,该分区正在为根文件系统提供服务。
我执行的命令是:
[root@...]pvresize /dev/sda3 --setphysicalvolumesize 40G
然后我尝试使用以下内容扩展 vg:
[root@...]# vgextend titan /dev/sda3
/dev/sdc: open failed: No medium found
WARNING: Device /dev/sda3 has size of 58351616 sectors which is smaller than corresponding PV size of 83884032 sectors. Was device resized?
WARNING: One or more devices used as PVs in VG vg have changed sizes.
Physical volume '/dev/sda3' is already in volume group 'vg'
Unable to add physical volume '/dev/sda3' to volume group 'vg'
/dev/sda3: physical volume not initialized.
在看到上面的输出后,我意识到我必须在我正在操作的单个磁盘上创建另一个分区并将其添加到 pv 组,扩展卷组,然后为根文件系统增加我的逻辑卷。
问题:如何安全地将物理卷大小恢复到我开始的位置,以使有关大小更改的警告消失?
在这里,您可以找到我认为您需要进一步指导解决方案的信息:
[root@...]# lsblk -b
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 480103981056 0 disk
├─sda1 8:1 0 629145600 0 part /boot/efi
├─sda2 8:2 0 1073741824 0 part /boot
└─sda3 8:3 0 29876027392 0 part
├─lv-root 253:0 0 21474836480 0 lvm /
└─lv-swap 253:1 0 8396996608 0 lvm [SWAP]
[root@t...]# pvdisplay -m -v
WARNING: Device /dev/sda3 has size of 58351616 sectors which is smaller than corresponding PV size of 83884032 sectors. Was device resized?
WARNING: One or more devices used as PVs in VG titan have changed sizes.
--- Physical volume ---
PV Name /dev/sda3
VG Name vg
PV Size <40.00 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 10239
Free PE 3117
Allocated PE 7122
PV UUID FgC2QI-pRpK-LZNS-di9w-Jc1d-XGXZ-2QxZI2
--- Physical Segments ---
Physical extent 0 to 5119:
Logical volume /dev/lv/root
Logical extents 0 to 5119
Physical extent 5120 to 7121:
Logical volume /dev/lv/swap
Logical extents 0 to 2001
Physical extent 7122 to 10238:
FREE