Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 5222 41430016 8e Linux LVM
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u').
Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (5222-6527, default 5222): Using default value 5222 Last cylinder, +cylinders or +size{K,M,G} (5222-6527, default 6527): Using default value 6527
然后修改分区类型为 8e 并写入分区表保存
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Command (m for help): t Partition number (1-4): 3 Hex code (type L to list codes): 8e Changed system type of partition 3 to 8e (Linux LVM)
Command (m for help): w The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy. 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) Syncing disks.
[root@localhost ~]# vgdisplay --- Volume group --- VG Name VolGroup System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 39.51 GiB PE Size 4.00 MiB Total PE 10114 Alloc PE / Size 10114 / 39.51 GiB Free PE / Size 0 / 0 VG UUID 2JrSeG-4Is7-ocIQ-zVrN-eha1-gYJQ-L1UnPn
/etc/lvm/archive/.lvm_localhost.localdomain_15862_675165963: write error failed: No space left on device Volume group "VolGroup" metadata archive failed. /etc/lvm/backup/VolGroup.tmp: write error failed: No space left on device Backup of volume group VolGroup metadata failed.
VolGroup 就是它了!
接下来 vgextend 扩容VG:
1 2 3 4
[root@localhost ~]# vgextend VolGroup /dev/sda3 /etc/lvm/archive/.lvm_localhost.localdomain_17322_173527374: write error failed: No space left on device Volume group "VolGroup" metadata archive failed. Internal error: Attempt to unlock unlocked VG #orphans.
结果因为剩余空间为零扩容失败,囧, 删除掉一些文件再试。
1 2
[root@localhost ~]# vgextend VolGroup /dev/sda3 Volume group "VolGroup" successfully extended
[root@localhost ~]# lvextend -L+10G /dev/mapper/VolGroup-lv_root /dev/sda3 Extending logical volume lv_root to 48.54 GiB Insufficient free space: 2560 extents needed, but only 2559 available
[root@localhost ~]# lvextend -L+9.99G /dev/mapper/VolGroup-lv_root /dev/sda3 Rounding size to boundary between physical extents: 9.99 GiB Extending logical volume lv_root to 48.53 GiB Logical volume lv_root successfully resized
文件系统扩容:
1 2 3 4 5 6
[root@localhost ~]# resize2fs /dev/mapper/VolGroup-lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing required old desc_blocks = 3, new_desc_blocks = 4 Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 12722176 (4k) blocks. The filesystem on /dev/mapper/VolGroup-lv_root is now 12722176 blocks long.