Bug 667509 - virt-clone removes sparseness from sparse raw images
Summary: virt-clone removes sparseness from sparse raw images
Keywords:
Status: CLOSED DUPLICATE of bug 522720
Alias: None
Product: Fedora
Classification: Fedora
Component: python-virtinst
Version: 14
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-05 19:57 UTC by Othman Madjoudj
Modified: 2011-07-11 17:15 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-11 17:15:46 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Othman Madjoudj 2011-01-05 19:57:11 UTC
Description of problem:

When I clone a VM with virt-clone the resulted VM have a bigger disk image size, I thinks is the real size given in VM so the growing feature is turned off by the cloning process, for eg:

--8<------------------------------------------------------------------
# du -h fedora-rawhide.img
4.8G	fedora-rawhide.img

# virt-clone --prompt
What is the name of the original virtual machine? fedora-rawhide
 What is the name for the cloned virtual machine? fedora-rawhide-test-vm
 What would you like to use as the cloned disk (file path) for '/var/lib/libvirt/images/fedora-rawhide.img'? /var/lib/libvirt/images/fedora-rawhide-test-vm.img
 This will overwrite the existing path '/var/lib/libvirt/images/fedora-rawhide-test-vm.img'
Do you really want to use this disk (yes or no) yes
Allocating 'fedora-rawhide-test-vm.img'                  |  18 GB     03:15     
 
Clone 'fedora-rawhide-test-vm' created successfully.

# du -h fedora-rawhide-test-vm.img
19G	fedora-rawhide-test-vm.img

--8<------------------------------------------------------------------

Version-Release number of selected component (if applicable):

python-virtinst-0.500.4-1.fc14.noarch
libvirt-0.8.3-2.fc14.x86_64
qemu-kvm-0.13.0-1.fc14.x86_64
qemu-img-0.13.0-1.fc14.x86_64

Fedora 14 x86_64 with the latest updates.

How reproducible:
Always

Steps to Reproduce:
See above
  
Actual results:
Disk image size is big

Expected results:
Disk image equal to the original (or at least close to)

Additional info:
Currently, I'm cloning VM with cp and import them to a VM.

Comment 1 Othman Madjoudj 2011-05-19 21:42:26 UTC
The same issue with newer packages:

python-virtinst-0.500.6-1.fc14.noarch
libvirt-0.8.3-9.fc14.x86_64
gpxe-roms-qemu-1.0.1-3.fc14.noarch
qemu-common-0.13.0-1.fc14.x86_64
qemu-img-0.13.0-1.fc14.x86_64
qemu-kvm-0.13.0-1.fc14.x86_64
qemu-system-x86-0.13.0-1.fc14.x86_64

Comment 2 Richard W.M. Jones 2011-05-23 22:21:53 UTC
It seems to be getting rid of sparseness.

What does virt-df say about the original image?

Comment 3 Othman Madjoudj 2011-05-23 23:00:35 UTC
I don't have the original VM, so I've done new tests.
NB. 'fedora-rawhide-test' is cloned from 'fedora-rawhide':  

]# du -h fedora-rawhide*
7.8G    fedora-rawhide.img
19G     fedora-rawhide-test.img

]# virt-df fedora-rawhide
Filesystem                           1K-blocks       Used  Available  Use%
fedora-rawhide:/dev/sda1                495844      72117     398127   15%
fedora-rawhide:/dev/vg_f15test/lv_root
                                      17029980    5702312   11154720   34%

]# virt-df fedora-rawhide-test
Filesystem                           1K-blocks       Used  Available  Use%
fedora-rawhide-test:/dev/sda1           495844      72117     398127   15%
fedora-rawhide-test:/dev/vg_f15test/lv_root
                                      17029980    5702312   11154720   34%

Comment 4 Richard W.M. Jones 2011-05-24 07:16:19 UTC
Updated summary line.

It's not likely we can fix this for the existing virt-clone,
but it's something to consider for the rewrite (or whatever
we decide to do with virt-clone in the end).

As an aside, you can use qemu-img to reintroduce
sparseness into any image.  Just do a dummy conversion
from (eg.) raw to raw and qemu-img will detect zeroes and
make the output sparse.

For raw (only) you can also just use the 'cp' command to
add sparseness.

It's all explained in the link below.

https://rwmj.wordpress.com/2010/10/19/tip-making-a-disk-image-sparse/

Comment 5 Othman Madjoudj 2011-05-24 11:47:48 UTC
Ok, thank you for the info, I'll stick with my cp/virt-install --import script, I'll be glad to test virt-clone NG.

Comment 6 Cole Robinson 2011-07-11 17:15:46 UTC

*** This bug has been marked as a duplicate of bug 522720 ***


Note You need to log in before you can comment on or make changes to this bug.