[PVE-User] Backup / Restore KVM-Image using qcow2

Knaupp, Thomas Thomas.Knaupp at schwarz.de
Thu Apr 18 21:27:26 CEST 2013


is it possible to restore a kvm machine using a qcow2 disk image in a way, that the image is "growing" and not allocating the full disk size?

I just did a backup of a machine and restored it on another server.
Disk size was 10x bigger after that.

Virtual disk on original server:

# ls -alF
total 8062524
drwxr-xr-x 2 root root        4096 Oct 25 21:24 ./
drwxr-xr-x 4 root root        4096 Oct 25 21:24 ../
-rw-r--r-- 1 root root 85912715264 Apr 18 15:58 vm-148-disk-1.qcow2

# du -sh

After vzdump it's only 2.7 GBs   :)

        695 Apr 18 16:05 vzdump-qemu-148-2013_04_18-15_58_52.log
 2745120768 Apr 18 16:05 vzdump-qemu-148-2013_04_18-15_58_52.tar

But after restoring on another server, it uses the full assigned 85 GB  -_-

# qmrestore vzdump-qemu-148-2013_04_18-15_58_52.tar 590
extracting archive '/root/vzdump-qemu-148-2013_04_18-15_58_52.tar'
extracting 'qemu-server.conf' from archive
extracting 'vm-disk-virtio0.qcow2' from archive
Formatting '/var/lib/vz/images/590/vm-590-disk-1.qcow2', fmt=qcow2 size=32768 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off
new volume ID is 'local:590/vm-590-disk-1.qcow2'
restore data to '/var/lib/vz/images/590/vm-590-disk-1.qcow2' (85912715264 bytes)
779+104311853 records in
327731+0 records out
85912715264 bytes (86 GB) copied, 1507.23 s, 57.0 MB/s

# ls -alF
total 83981168
drwxrwxrwx 2 root root        4096 Apr 18 16:10 ./
drwxr-xr-x 3 root root        4096 Apr 18 16:10 ../
-rw-r--r-- 1 root root 85912715264 Apr 18 21:15 vm-590-disk-1.qcow2

# du -sh

I want the virt. disk to be 80 GB. So making it smaller is no option.
But I just don't want to allocate that much space from the start when it's not needed yet.

Any hints?

Kind regards


Schwarz Computer Systeme GmbH
Altenhofweg 2a
92318 Neumarkt

Geschaeftsfuehrer: Manfred Schwarz
Sitz der Gesellschaft: Neumarkt i.d.Opf.
Registergericht: AG Nuernberg, HRB 11908

Diese eMail enthaelt moeglicherweise vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese eMail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese eMail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This email may contain confidential and/or privileged information. If you are not the intended recipient (or have received this email in error) please notify the sender immediately and destroy this email. Any unauthorized copying, disclosure or distribution of the material in this email is strictly forbidden.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5832 bytes
Desc: not available
URL: <http://lists.proxmox.com/pipermail/pve-user/attachments/20130418/1a060c3a/attachment.bin>

More information about the pve-user mailing list