<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pt-BR">
	<id>https://wiki.slacam.com.br/index.php?action=history&amp;feed=atom&amp;title=Aumenta_disco_KVM</id>
	<title>Aumenta disco KVM - Histórico de revisão</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.slacam.com.br/index.php?action=history&amp;feed=atom&amp;title=Aumenta_disco_KVM"/>
	<link rel="alternate" type="text/html" href="https://wiki.slacam.com.br/index.php?title=Aumenta_disco_KVM&amp;action=history"/>
	<updated>2026-11-17T00:50:19Z</updated>
	<subtitle>Histórico de revisões para esta página neste wiki</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.slacam.com.br/index.php?title=Aumenta_disco_KVM&amp;diff=843&amp;oldid=prev</id>
		<title>Machado: Criou página com &#039;Aumentar a partição de disco de uma VM  METHOD #1: Partitions are ext2/ext3/ext4 based  The nuts of this method are as follows:  # 1. stop the VM # 2. move the current image...&#039;</title>
		<link rel="alternate" type="text/html" href="https://wiki.slacam.com.br/index.php?title=Aumenta_disco_KVM&amp;diff=843&amp;oldid=prev"/>
		<updated>2015-10-17T10:43:39Z</updated>

		<summary type="html">&lt;p&gt;Criou página com &amp;#039;Aumentar a partição de disco de uma VM  METHOD #1: Partitions are ext2/ext3/ext4 based  The nuts of this method are as follows:  # 1. stop the VM # 2. move the current image...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nova&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Aumentar a partição de disco de uma VM&lt;br /&gt;
&lt;br /&gt;
METHOD #1: Partitions are ext2/ext3/ext4 based&lt;br /&gt;
&lt;br /&gt;
The nuts of this method are as follows:&lt;br /&gt;
&lt;br /&gt;
# 1. stop the VM&lt;br /&gt;
# 2. move the current image&lt;br /&gt;
mv mykvm.img mykvm.img.bak&lt;br /&gt;
&lt;br /&gt;
# 3. create a new image&lt;br /&gt;
qemu-img create -f raw addon.raw 30G&lt;br /&gt;
&lt;br /&gt;
# 4. concatenate the 2 images&lt;br /&gt;
cat mykvm.img.bak addon.raw &amp;gt;&amp;gt; mykvm.img&lt;br /&gt;
&lt;br /&gt;
Now with the larger mykvm.img file in hand, boot gparted and extend the existing partition into the newly added disk space. This last step basically extends the OS partition so that it can make use of the extra space.&lt;br /&gt;
&lt;br /&gt;
METHOD #2: Partitions are LVM based&lt;br /&gt;
&lt;br /&gt;
Here are the steps that I roughly followed to resize a KVM guest that used LVM internally.&lt;br /&gt;
&lt;br /&gt;
    Shutdown the VM&lt;br /&gt;
    add more space to the guest&amp;#039;s &amp;quot;image file&amp;quot; (something like: cat old.img 10G_addon.raw &amp;gt;&amp;gt; new.img&lt;br /&gt;
    start the VM (using the newly created new.img)&lt;br /&gt;
&lt;br /&gt;
    run fdisk inside VM and delete &amp;amp; re-create LVM partition&lt;br /&gt;
&amp;#039;&amp;#039;% fdisk /dev/vda&lt;br /&gt;
...&lt;br /&gt;
Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;
/dev/vda1   *           1          13      104391   83  Linux&lt;br /&gt;
/dev/vda2              14        3263    26105625   8e  Linux LVM&lt;br /&gt;
&lt;br /&gt;
Command (m for help): d&lt;br /&gt;
Partition number (1-4): 2&lt;br /&gt;
&lt;br /&gt;
Command (m for help): p&lt;br /&gt;
&lt;br /&gt;
Disk /dev/vda: 48.3 GB, 48318382080 bytes&lt;br /&gt;
255 heads, 63 sectors/track, 5874 cylinders&lt;br /&gt;
Units = cylinders of 16065 * 512 = 8225280 bytes&lt;br /&gt;
&lt;br /&gt;
Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;
/dev/vda1   *           1          13      104391   83  Linux&lt;br /&gt;
&lt;br /&gt;
Command (m for help): n &lt;br /&gt;
Command action&lt;br /&gt;
  e   extended&lt;br /&gt;
  p   primary partition (1-4)&lt;br /&gt;
p&lt;br /&gt;
Partition number (1-4): 2&lt;br /&gt;
First cylinder (14-5874, default 14): 14&lt;br /&gt;
Last cylinder or +size or +sizeM or +sizeK (14-5874, default 5874): &lt;br /&gt;
Using default value 5874&lt;br /&gt;
&lt;br /&gt;
Command (m for help): p&lt;br /&gt;
&lt;br /&gt;
Disk /dev/vda: 48.3 GB, 48318382080 bytes&lt;br /&gt;
255 heads, 63 sectors/track, 5874 cylinders&lt;br /&gt;
Units = cylinders of 16065 * 512 = 8225280 bytes&lt;br /&gt;
&lt;br /&gt;
Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;
/dev/vda1   *           1          13      104391   83  Linux&lt;br /&gt;
/dev/vda2              14        5874    47078482+  83  Linux&lt;br /&gt;
&lt;br /&gt;
Command (m for help): t&lt;br /&gt;
Partition number (1-4): 2&lt;br /&gt;
Hex code (type L to list codes): 8e&lt;br /&gt;
Changed system type of partition 2 to 8e (Linux LVM)&lt;br /&gt;
&lt;br /&gt;
Command (m for help): p&lt;br /&gt;
&lt;br /&gt;
Disk /dev/vda: 48.3 GB, 48318382080 bytes&lt;br /&gt;
255 heads, 63 sectors/track, 5874 cylinders&lt;br /&gt;
Units = cylinders of 16065 * 512 = 8225280 bytes&lt;br /&gt;
&lt;br /&gt;
Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;
/dev/vda1   *           1          13      104391   83  Linux&lt;br /&gt;
/dev/vda2              14        5874    47078482+  8e  Linux LVM&lt;br /&gt;
&lt;br /&gt;
Command (m for help): w&lt;br /&gt;
The partition table has been altered!&lt;br /&gt;
&lt;br /&gt;
Calling ioctl() to re-read partition table.&lt;br /&gt;
&lt;br /&gt;
WARNING: Re-reading the partition table failed with error 16: Device or &lt;br /&gt;
resource busy.&lt;br /&gt;
The kernel still uses the old table.&lt;br /&gt;
The new table will be used at the next reboot.&lt;br /&gt;
Syncing disks.&lt;br /&gt;
%&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
    Reboot the VM&lt;br /&gt;
&lt;br /&gt;
    Resize the LVM physical volume&lt;br /&gt;
&lt;br /&gt;
    % pvdisplay &lt;br /&gt;
      --- Physical volume ---&lt;br /&gt;
      PV Name               /dev/vda2&lt;br /&gt;
      VG Name               VolGroup00&lt;br /&gt;
      PV Size               24.90 GB / not usable 21.59 MB&lt;br /&gt;
      Allocatable           yes (but full)&lt;br /&gt;
      PE Size (KByte)       32768&lt;br /&gt;
      Total PE              796&lt;br /&gt;
      Free PE               0&lt;br /&gt;
      ...&lt;br /&gt;
&lt;br /&gt;
    % pvresize /dev/vda2&lt;br /&gt;
&lt;br /&gt;
    % pvdisplay&lt;br /&gt;
      --- Physical volume ---&lt;br /&gt;
      PV Name               /dev/vda2&lt;br /&gt;
      VG Name               VolGroup00&lt;br /&gt;
      PV Size               44.90 GB / not usable 22.89 MB&lt;br /&gt;
      Allocatable           yes &lt;br /&gt;
      PE Size (KByte)       32768&lt;br /&gt;
      Total PE              1436&lt;br /&gt;
      Free PE               640&lt;br /&gt;
      ...&lt;br /&gt;
&lt;br /&gt;
    Resize the LVM Logical Volume&lt;br /&gt;
&lt;br /&gt;
      % lvresize /dev/VolGroup00/LogVol00 -l +640&lt;br /&gt;
      Extending logical volume LogVol00 to 43.88 GB&lt;br /&gt;
      Logical volume LogVol00 successfully resized&lt;br /&gt;
&lt;br /&gt;
    Grow the File system&lt;br /&gt;
&lt;br /&gt;
      % resize2fs /dev/VolGroup00/LogVol00 &lt;br /&gt;
      resize2fs 1.39 (29-May-2006)&lt;br /&gt;
      Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required&lt;br /&gt;
      Performing an on-line resize of /dev/VolGroup00/LogVol00 to 11501568 (4k) blocks.&lt;br /&gt;
      The filesystem on /dev/VolGroup00/LogVol00 is now 11501568 blocks long.&lt;br /&gt;
&lt;br /&gt;
The above is my example, but I followed the steps on this website&lt;/div&gt;</summary>
		<author><name>Machado</name></author>
	</entry>
</feed>