Aqui estão os passos que eu segui para redimensionar um convidado KVM que usava o LVM internamente.
- Desligar a VM
- adicione mais espaço ao "arquivo de imagem" do convidado (algo como: cat old.img 10G_addon.raw > > new.img
- inicie a VM (usando o recém-criado new.img)
-
execute o fdisk dentro da VM e exclua & recriar a partição LVM
% fdisk /dev/vda ... Device Boot Start End Blocks Id System /dev/vda1 * 1 13 104391 83 Linux /dev/vda2 14 3263 26105625 8e Linux LVM Command (m for help): d Partition number (1-4): 2 Command (m for help): p Disk /dev/vda: 48.3 GB, 48318382080 bytes 255 heads, 63 sectors/track, 5874 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/vda1 * 1 13 104391 83 Linux Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (14-5874, default 14): 14 Last cylinder or +size or +sizeM or +sizeK (14-5874, default 5874): Using default value 5874 Command (m for help): p Disk /dev/vda: 48.3 GB, 48318382080 bytes 255 heads, 63 sectors/track, 5874 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/vda1 * 1 13 104391 83 Linux /dev/vda2 14 5874 47078482+ 83 Linux Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 8e Changed system type of partition 2 to 8e (Linux LVM) Command (m for help): p Disk /dev/vda: 48.3 GB, 48318382080 bytes 255 heads, 63 sectors/track, 5874 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/vda1 * 1 13 104391 83 Linux /dev/vda2 14 5874 47078482+ 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. Syncing disks. %
-
Reinicialize a VM
-
Redimensione o volume físico do LVM
% pvdisplay --- Physical volume --- PV Name /dev/vda2 VG Name VolGroup00 PV Size 24.90 GB / not usable 21.59 MB Allocatable yes (but full) PE Size (KByte) 32768 Total PE 796 Free PE 0 ... % pvresize /dev/vda2 % pvdisplay --- Physical volume --- PV Name /dev/vda2 VG Name VolGroup00 PV Size 44.90 GB / not usable 22.89 MB Allocatable yes PE Size (KByte) 32768 Total PE 1436 Free PE 640 ...
-
Redimensione o volume lógico do LVM
% lvresize /dev/VolGroup00/LogVol00 -l +640 Extending logical volume LogVol00 to 43.88 GB Logical volume LogVol00 successfully resized
-
Cresça o sistema de arquivos
% resize2fs /dev/VolGroup00/LogVol00 resize2fs 1.39 (29-May-2006) Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required Performing an on-line resize of /dev/VolGroup00/LogVol00 to 11501568 (4k) blocks. The filesystem on /dev/VolGroup00/LogVol00 is now 11501568 blocks long.
O exemplo acima é o meu, mas eu segui os passos deste site