# 将vdi格式的文件重新转换为vmdk格式,会产生一个新的uuid % vboxmanage clonehd new-centos-vm-disk1.vdi resized.vmdk --format vmdk 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Clone medium created in format 'vmdk'. UUID: 7e454b50-0681-494b-b9ca-81700d217c0a
# 继续输入p,可以看到磁盘的情况,多出了/dev/sda3 # /dev/sda3的System为Linux,而/dev/sda2的System为Linux LVM Command (m for help): p
Disk /dev/sda: 85.9 GB, 85899345920 bytes, 167772160 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0000ca5e
Device Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 20479999 9726976 8e Linux LVM /dev/sda3 20480000 167772159 73646080 83 Linux
# 依次输入将/dev/sda3更改为LVM格式 t 3 8e p
Disk /dev/sda: 85.9 GB, 85899345920 bytes, 167772160 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0000ca5e
Device Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 20479999 9726976 8e Linux LVM /dev/sda3 20480000 167772159 73646080 8e Linux LVM
# 输入w后进行保存操作 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.
# vgdisplay --- Volume group --- VG Name centos 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 9.27 GiB PE Size 4.00 MiB Total PE 2374 Alloc PE / Size 2364 / 9.23 GiB Free PE / Size 10 / 40.00 MiB VG UUID cpEmYK-XFew-6ZWT-GEeY-yEou-0vLq-OJiD08
# lvscan ACTIVE '/dev/centos/swap' [1000.00 MiB] inherit ACTIVE '/dev/centos/root' [<8.26 GiB] inherit