设备 Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 20971519 9972736 8e Linux LVM /dev/sda3 20971520 41943039 10485760 83 Linux
命令(输入 m 获取帮助):t 分区号 (1-3,默认 3):3 Hex 代码(输入 L 列出所有代码):8e 已将分区“Linux”的类型更改为“Linux LVM”
设备 Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 20971519 9972736 8e Linux LVM /dev/sda3 20971520 41943039 10485760 8e Linux LVM
命令(输入 m 获取帮助):w The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8)
发现没有sda3 设备文件,内核重读
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[root@localhost dev]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 20G 0 disk ├─sda1 8:1 0 500M 0 part /boot └─sda2 8:2 0 9.5G 0 part ├─rhel-root 253:0 0 8.5G 0 lvm / └─rhel-swap 253:1 0 1G 0 lvm [SWAP] [root@localhost dev]# partprobe # 内核重读命令 [root@localhost dev]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 20G 0 disk ├─sda1 8:1 0 500M 0 part /boot ├─sda2 8:2 0 9.5G 0 part │ ├─rhel-root 253:0 0 8.5G 0 lvm / │ └─rhel-swap 253:1 0 1G 0 lvm [SWAP] └─sda3 8:3 0 10G 0 part
4 扩展vg
1 2 3 4 5
[root@localhost /]# vgextend rhel /dev/sda3 # 将/dev/sda3 分区添加到rhel VG WARNING: dos signature detected on /dev/sda3 at offset 510. Wipe it? [y/n] y Wiping dos signature on /dev/sda3. Physical volume "/dev/sda3" successfully created Volume group "rhel" successfully extended