我使用两个逻辑卷的LVM:
//var/log目录这两个LV基于物理卷/dev/sda3 3。设备/dev/sda正在使用GPT分区表。
我的目的是调整分区/dev/sda3 3的大小,以占用磁盘上的所有空闲内存。
为此,我使用了gdisk命令:
这是我拥有的当前分区表:
Command (? for help): p
Disk /dev/sda: 4294967296 sectors, 2.0 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 546DEB45-C1DE-402B-BB51-4011AC159B4F
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 4294967262
Partitions will be aligned on 8-sector boundaries
Total free space is 4188012544 sectors (2.0 TiB)
Number Start (sector) End (sector) Size Code Name
1 34 614433 300.0 MiB EF00
2 614434 17386294 8.0 GiB 8200
3 17386295 106954718 42.7 GiB 8E00这就是我调整第三个分区大小时所做的:
Command (? for help): d
Partition number (1-3): 3
Command (? for help): n
Partition number (3-128, default 3): 3
First sector (17386295-4294967262, default = 17386296) or {+-}size{KMGTP}:
Last sector (17386296-4294967262, default = 4294967262) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8e00
Changed type of partition to 'Linux LVM'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.实际上,第三个分区有一个新的大小:
Command (? for help): p
Disk /dev/sda: 4294967296 sectors, 2.0 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 546DEB45-C1DE-402B-BB51-4011AC159B4F
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 4294967262
Partitions will be aligned on 8-sector boundaries
Total free space is 1 sectors (512 bytes)
Number Start (sector) End (sector) Size Code Name
1 34 614433 300.0 MiB EF00
2 614434 17386294 8.0 GiB 8200
3 17386296 4294967262 2.0 TiB 8E00 Linux LVM现在,我需要将分区表中的新更改通知内核。
据我所知,有三种选择:
partprobe:
Error: Partition(s) 3 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
partx -uv /dev/sda:
partition: none, disk: /dev/sda, lower: 0, upper: 0
/dev/sda: partition table type 'gpt' detected
/dev/sda: partition #1 resized
/dev/sda: partition #2 resized
/dev/sda: partition #3 resized
partx: /dev/sda: updating partition #3 failed: Invalid argument
partx: /dev/sda: error updating partition 3reboot:机器没有恢复,我输入了一个KDB外壳。
问:我做错了什么,增加/dev/sda3 3分区大小的正确方法是什么?
顺便说一句,我注意到当我使用像100GiB这样的较小的磁盘(而不是前面使用的2TiB )时,partx -uv /dev/sda命令可以正常工作,而不会引发错误(partprobe仍然在抱怨)。这怎么解释呢?
感谢你的帮助!
发布于 2022-08-10 14:26:41
从gdisk结果中可以看到的是,您在开始之前和之后的开始扇区之间存在差异。
3 17386295 106954718 42.7 GiB 8E00
和
3 17386296 4294967262 2.0 TiB 8E00 Linux
这会导致LVM出现问题,因为它无法识别PV的适当信息。尝试纠正此情况(将开始扇区设置为17386295),分区作为PV的可见性将被恢复。
https://unix.stackexchange.com/questions/712757
复制相似问题