title: Why rsync --sparse produce bigger qcow2 files than original qcow2 files
body: <h1>Problem:</h1>
  <p>When i´am copying the whole disk with my virtual machines onto anemty disk with rsync --sparse the disk images (qcow2 files) on the new Disk are bigger then the original files.</p>
  <p><em>Old Disk:</em>
  /dev/sda1 =&gt; /ssdstor</p>
  <p><em>New Disk:</em>
  /dev/sdb1 =&gt; /new</p>
  <h2>Details:</h2>
  <p><em>Hardware:</em>
  2x SSD Curcial M500 960GB Firmware MU5</p>
  <p><em>OS:</em> Proxmox 3.4</p>
  <p><em>Filesyste:</em> XFS</p>
  <p><em>Command:</em></p>
  <pre><code>rsync -axHv --force --progress --stats --sparse /ssdstor/ /new/
  </code></pre>
  <p><em>Rsync Version:</em>
  <em>dpkg -L | grep rsync</em></p>
  <pre><code>ii  rsync                                         993.1.1-1                     amd64        fast, versatile, remote (and local) file-copying tool
  </code></pre>
  <ul>
  <li>file / disk comparison after first copy*
  ( to check everything was transfered correctly )</li>
  </ul>
  <p>rsync -axHv --dry-run --force --progress --stats --sparse /ssdstor/ /new/</p>
  <pre><code>sending incremental file list
  
  Number of files: 90,545 (reg: 70,269, dir: 9,395, link: 10,817, dev: 4, special: 60)
  Number of created files: 0
  Number of deleted files: 0
  Number of regular files transferred: 0
  Total file size: 634,456,255,674 bytes
  Total transferred file size: 0 bytes
  Literal data: 0 bytes
  Matched data: 0 bytes
  File list size: 65,536
  File list generation time: 0.001 seconds
  File list transfer time: 0.000 seconds
  Total bytes sent: 2,097,654
  Total bytes received: 9,993
  
  sent 2,097,654 bytes  received 9,993 bytes  1,405,098.00 bytes/sec
  total size is 634,456,255,674  speedup is 301,025.86 (DRY RUN)
  </code></pre>
  <p><em>mount | egrep '(sda|sdb)'</em></p>
  <pre><code>/dev/sda1 on /ssdstor type xfs (rw,noatime,nodiratime,attr2,inode64,noquota)
  /dev/sdb1 on /new type xfs (rw,noatime,nodiratime,attr2,inode64,noquota)
  </code></pre>
  <p><em>df -h  | egrep '(sda|sdb)'</em></p>
  <pre><code>/dev/sda1             894G    388G  506G   44% /ssdstor
  /dev/sdb1             894G    430G  465G   49% /new
  </code></pre>
  <p><em>ls -alshR /ssdstor | grep qcow2</em></p>
  <pre><code>77G -rw-r--r--  1 root root 103G Jul 14 09:09 vm-100-disk-1.qcow2
  6,2G -rw-r--r--  1 root root  14G Jul 14 09:07 vm-101-disk-1.qcow2
  2,0G -rw-r--r--  1 root root 4,1G Jul 14 09:07 vm-101-disk-2.qcow2
  17G -rw-r--r--  1 root root 61G Feb 18 09:10 vm-102-disk-1.qcow2
  40G -rw-r--r--  1 root root 78G Jul 14 09:06 vm-103-disk-1.qcow2
  40G -rw-r--r--  1 root root 41G Jul 14 09:05 vm-103-disk-2.qcow2
  31G -rw-r--r--  1 root root 44G Jul 14 09:05 vm-104-disk-1.qcow2
  5,2G -rw-r--r--  1 root root 41G Mai  1 01:00 vm-105-disk-2.qcow2
  63G -rw-r--r--  1 root root 65G Jul 14 10:04 vm-106-disk-1.qcow2
  26G -rw-r--r--  1 root root 65G Jul 14 09:14 vm-107-disk-2.qcow2
  51G -rw-r--r--  1 root root 51G Mai 19 21:21 vm-108-disk-1.qcow2
  </code></pre>
  <p><em>ls -alshR /new | grep qcow2</em></p>
  <pre><code>79G -rw-r--r--  1 root root 103G Jul 14 09:09 vm-100-disk-1.qcow2
  6,2G -rw-r--r--  1 root root  14G Jul 14 09:07 vm-101-disk-1.qcow2
  2,0G -rw-r--r--  1 root root 4,1G Jul 14 09:07 vm-101-disk-2.qcow2
  17G -rw-r--r--  1 root root 61G Feb 18 09:10 vm-102-disk-1.qcow2
  40G -rw-r--r--  1 root root 78G Jul 14 09:06 vm-103-disk-1.qcow2
  41G -rw-r--r--  1 root root 41G Jul 14 09:05 vm-103-disk-2.qcow2
  37G -rw-r--r--  1 root root 44G Jul 14 09:05 vm-104-disk-1.qcow2
  34G -rw-r--r--  1 root root 41G Mai  1 01:00 vm-105-disk-2.qcow2
  63G -rw-r--r--  1 root root 65G Jul 14 10:04 vm-106-disk-1.qcow2
  33G -rw-r--r--  1 root root 65G Jul 14 09:14 vm-107-disk-2.qcow2
  51G -rw-r--r--  1 root root 51G Mai 19 21:21 vm-108-disk-1.qcow2
  </code></pre>
  <p>Has anyone an idea?</p>
  <p>More Tests:</p>
  <p>cp --sparse=always vm-105-disk-2.qcow2 vm-105-disk-2.qcow2.new</p>
  <pre><code>5,2G -rw-r--r--  1 root root 41G Jul 16 08:07 vm-105-disk-2.qcow2
   34G -rw-r--r--  1 root root 41G Jul 16 11:51 vm-105-disk-2.qcow2.new
  </code></pre>