Difference between revisions of "Qemu-img resize"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Draft}}
+
* [[Extend LVM on qcow2 images]]
 +
 
 +
qemu-img resize image_name.qcow2 +3G
 +
image resized.
  
 +
Verify:
 +
 +
[[qemu-img info]] image_name.qcow2
 +
image: image_name.qcow2
 +
file format: qcow2
 +
virtual size: 500G (536870912000 bytes)
 +
disk size: 246G
 +
cluster_size: 65536
 +
Format specific information:
 +
    compat: 1.1
 +
    lazy refcounts: true
 +
    refcount bits: 16
 +
    corrupt: false
  
* [[Extend LVM on qcow2 images]]
 
  
  qemu-img resize image_name +3G
+
== Shrink ==
  image resized.
+
Your new image cannot be bootable. Make sure you understand implications.
 +
 
 +
  qemu-img resize YOUR_VM_MACHINE_NAME.img -10G
 +
  qemu-img: warning: Shrinking an image will delete all data beyond the shrunken image's end. Before performing such an operation, make sure there is no important data there.
 +
qemu-img: Use the --shrink option to perform a shrink operation
 +
 
 +
qemu-img resize --shrink YOUR_VM_MACHINE_NAME.img -10G
 +
Image resized.
  
  
 
Process:
 
Process:
* <code>qemu-img resize</code> -> [[virt-resize]] -> [[lvextend --resizefs]]
+
* <code>[[qemu-img resize]]</code> -> <code>[[virt-resize]]</code> -> <code>[[lvextend|lvextend --resizefs]]</code>
  
  
 
== Related commands ==
 
== Related commands ==
 
* <code>[[virt-resize]]</code>
 
* <code>[[virt-resize]]</code>
 +
* <code>[[virt-filesystems]]</code>
 
* <code>[[virsh blockresize]]</code>
 
* <code>[[virsh blockresize]]</code>
 +
* <code>[[virt-sparsify]]</code>
  
 
== Activities ==
 
== Activities ==

Latest revision as of 13:27, 11 April 2021

qemu-img resize image_name.qcow2 +3G
image resized.
Verify: 

qemu-img info image_name.qcow2
image: image_name.qcow2
file format: qcow2
virtual size: 500G (536870912000 bytes)
disk size: 246G
cluster_size: 65536 
Format specific information:
   compat: 1.1
   lazy refcounts: true
   refcount bits: 16
   corrupt: false


Shrink[edit]

Your new image cannot be bootable. Make sure you understand implications.

qemu-img resize YOUR_VM_MACHINE_NAME.img -10G
qemu-img: warning: Shrinking an image will delete all data beyond the shrunken image's end. Before performing such an operation, make sure there is no important data there.
qemu-img: Use the --shrink option to perform a shrink operation
qemu-img resize --shrink YOUR_VM_MACHINE_NAME.img -10G
Image resized.


Process:


Related commands[edit]

Activities[edit]

See also[edit]

Advertising: