Bug 667509 - virt-clone removes sparseness from sparse raw images
virt-clone removes sparseness from sparse raw images
Status: CLOSED DUPLICATE of bug 522720
Product: Fedora
Classification: Fedora
Component: python-virtinst (Show other bugs)
14
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Cole Robinson
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-05 14:57 EST by Athmane Madjoudj
Modified: 2011-07-11 13:15 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-07-11 13:15:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Athmane Madjoudj 2011-01-05 14:57:11 EST
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 Athmane Madjoudj 2011-05-19 17:42:26 EDT
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 18:21:53 EDT
It seems to be getting rid of sparseness.

What does virt-df say about the original image?
Comment 3 Athmane Madjoudj 2011-05-23 19:00:35 EDT
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 03:16:19 EDT
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 Athmane Madjoudj 2011-05-24 07:47:48 EDT
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 13:15:46 EDT

*** 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.