<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Sparse File on nagg.eu</title><link>https://nagg.eu/tags/sparse-file/</link><description>Recent content in Sparse File on nagg.eu</description><generator>Hugo</generator><language>en</language><lastBuildDate>Wed, 09 Nov 2016 18:19:35 +0000</lastBuildDate><atom:link href="https://nagg.eu/tags/sparse-file/index.xml" rel="self" type="application/rss+xml"/><item><title>Copy Linux sparse files over network</title><link>https://nagg.eu/copy-linux-sparse-files-over-network/</link><pubDate>Wed, 09 Nov 2016 18:19:35 +0000</pubDate><guid>https://nagg.eu/copy-linux-sparse-files-over-network/</guid><description>&lt;p&gt;Sparse files are nice to use to store virtual machine&amp;rsquo;s virtual disks but can be a real pain in the ass to backup efficiently, especially over the network.&lt;br&gt;
Luckily &lt;code&gt;rsync&lt;/code&gt; provides a way to intelligently copy sparse files both locally and over the network.&lt;br&gt;
The trick is use &lt;code&gt;--sparse&lt;/code&gt; and &lt;code&gt;--inplace&lt;/code&gt; options.&lt;br&gt;
Let&amp;rsquo;s say we have a sparse 60 GB qemu virtual disk with only around 7 GB used:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ ls -lh fedora24.qcow2 
-rw------- 1 root root 61G Nov 8 19:11 fedora24.qcow2
$ du -h fedora24.qcow2 
7.2G	fedora24.qcow2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The first thing to note is that ls does not recognize sparse files while du does.&lt;br&gt;
The first time a file is copied use the &lt;code&gt;--sparse&lt;/code&gt; option:&lt;/p&gt;</description></item></channel></rss>