<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://dev1galaxy.org/extern.php?action=feed&amp;tid=5984&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / Question, about dd and/or qemu, for disk cloning]]></title>
		<link>http://dev1galaxy.org/viewtopic.php?id=5984</link>
		<description><![CDATA[The most recent posts in Question, about dd and/or qemu, for disk cloning.]]></description>
		<lastBuildDate>Tue, 17 Oct 2023 20:35:04 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44921#p44921</link>
			<description><![CDATA[<p>I use ivy bridge fest3er, so it might be more like 300mb per second depending on the drive lol.</p>]]></description>
			<author><![CDATA[dummy@example.com (zapper)]]></author>
			<pubDate>Tue, 17 Oct 2023 20:35:04 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44921#p44921</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44904#p44904</link>
			<description><![CDATA[<p>I haven&#039;t tried this, but it ought to work: <a href="https://gist.github.com/shamil/62935d9b456a6f9877b5" rel="nofollow">https://gist.github.com/shamil/62935d9b456a6f9877b5</a>.</p><p>In short:</p><ol class="decimal"><li><p><span class="bbc">modprobe nbd</span></p></li><li><p>Create the QCOW2 image same (virtual) size as the HD.</p></li><li><p>Connect to the QCOW2 (see link above).</p></li><li><p>Mount the HD&#039;s filesystems.</p></li><li><p>On each of these FSen, <span class="bbc">dd if=/dev/zero of=null.zero bs=1024k; sync; rm null.zero</span> to use up all free blocks, fill them with nulls, then erase the file. Neither perfect nor complete, but it&#039;ll zero most free blocks. You will have to &lt;CTRL/C&gt; dd if it doesn&#039;t quit when it exhausts free space. (This&#039;ll work on all FSen, not just EXT[234].) Also be aware that some FSen may still have limits on the maximum file size; you might have to create several nullX.zero files.</p></li><li><p>Unmount the HD&#039;s filesystems.</p></li><li><p>As root, <span class="bbc">dd --sparse</span> the raw HD device to the QCOW2 NBD device.</p></li><li><p>Disconnect from the QCOW2 (see link above)</p></li><li><p><span class="bbc">rmmod nbd</span></p></li></ol><p>Given the price and size of storage these days (and sufficient funds), it might be better to buy a large SSD or NVME and copy the HD onto a corner of it. If, of course, the above doesn&#039;t work well.</p><p>Whichever way you use, it will take quite some time. 500GB at 1.5 Gb/s ain&#039;t fast. And you&#039;re doing it twice (once to zero free blocks, and again to copy the drive).</p>]]></description>
			<author><![CDATA[dummy@example.com (fest3er)]]></author>
			<pubDate>Mon, 16 Oct 2023 16:54:51 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44904#p44904</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44357#p44357</link>
			<description><![CDATA[<div class="quotebox"><cite>alphalpha wrote:</cite><blockquote><div><p>you can copy the whole disc and then shrink the qcow</p></div></blockquote></div><p>I have tried that, but for some reason, errors occurred for me and so I gave it up.</p><p>Maybe I am missing something?</p>]]></description>
			<author><![CDATA[dummy@example.com (zapper)]]></author>
			<pubDate>Sat, 16 Sep 2023 04:46:52 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44357#p44357</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44354#p44354</link>
			<description><![CDATA[<p>You can use dd to create a 500G &quot;empty&quot; sparse file:</p><div class="codebox"><pre><code>dd if=/dev/zero of=/mysparsefile bs=1G count=0 seek=500</code></pre></div><p>Though after that you still have the problem of identifying which blocks on /dev/sda are in use so as to copy those. If you have run zerofree, i.e. made all unused blocks be zeroed, then another dd would do the job, e.g.</p><div class="codebox"><pre><code>dd if=/dev/sda2 of=/mysparsefile conv=sparse,notrunc</code></pre></div><p>Obviously mysparsefile needs to be somewhere with enough space but not on /dev/sda (as it then will fill up the 500G by copying its own blocks)</p>]]></description>
			<author><![CDATA[dummy@example.com (ralph.ronnquist)]]></author>
			<pubDate>Fri, 15 Sep 2023 23:25:33 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44354#p44354</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44352#p44352</link>
			<description><![CDATA[<p>you can copy the whole disc and then shrink the qcow</p>]]></description>
			<author><![CDATA[dummy@example.com (alphalpha)]]></author>
			<pubDate>Fri, 15 Sep 2023 23:14:21 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44352#p44352</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44350#p44350</link>
			<description><![CDATA[<div class="quotebox"><cite>boughtonp wrote:</cite><blockquote><div><p>Yeah, like if you had this situation:</p><div class="codebox"><pre><code>$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        50G   20G   30G  40% /
/dev/sda2       450G   80G  270G  18% /home</code></pre></div><p>You&#039;d want a single 100GB <em>sparse</em> file, which still retains the 500GB capacity.</p></div></blockquote></div><p>Correct, but actually, I may have changed my mind slightly, is there any easy solution in devuan included in doing this? Even that might be helpful. Preferably one that isn&#039;t mega slow.</p><p>2 hours is fine, anything longer would be painful.</p><p>500GB disk btw.</p>]]></description>
			<author><![CDATA[dummy@example.com (zapper)]]></author>
			<pubDate>Fri, 15 Sep 2023 22:48:10 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44350#p44350</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44349#p44349</link>
			<description><![CDATA[<p>so zerofree would work for what I want? Is that correct? </p><p>I guess I should try this then?</p>]]></description>
			<author><![CDATA[dummy@example.com (zapper)]]></author>
			<pubDate>Fri, 15 Sep 2023 22:45:17 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44349#p44349</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44313#p44313</link>
			<description><![CDATA[<p>The point of zerofree (or just doing <span class="bbc">cat /dev/zero&gt;zero.bin; rm zero.bin</span>) is to reduce the size of a packed image file created with <br />dd or cat, e.g. <span class="bbc">cat /dev/sdXn | gzip &gt;sdXn.img.gz</span>. </p><p>When creating a partition image file as sparse file, these sectors are omitted anyway.</p>]]></description>
			<author><![CDATA[dummy@example.com (delgado)]]></author>
			<pubDate>Thu, 14 Sep 2023 13:32:41 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44313#p44313</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44306#p44306</link>
			<description><![CDATA[<p>Heh, I don&#039;t recall encountering <a href="https://manpages.debian.org/bookworm/zerofree/zerofree.8.en.html" rel="nofollow">zerofree</a> before - I wonder if that might have been the missing step that stopped some of my attempts from working.</p>]]></description>
			<author><![CDATA[dummy@example.com (boughtonp)]]></author>
			<pubDate>Thu, 14 Sep 2023 12:09:17 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44306#p44306</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44279#p44279</link>
			<description><![CDATA[<p>@zapper, I think you can use the <span class="bbc">zerofree</span> program for <span class="bbc">ext[234]</span> filesystems to get all unused blocks of their partitions to be zeroed. Perhaps similar tools exist for other filesystems, if that&#039;s what you have.</p><p>Then according to its man page,&#160; <span class="bbc">qemu-img</span> has the <span class="bbc">-S size</span> argument whereby it translates contiguous runs of zeros as holes.</p><p>And <span class="bbc">dd</span> can do something similar with the <span class="bbc">conv=sparse</span> argument, though only into a sparse raw image file.</p>]]></description>
			<author><![CDATA[dummy@example.com (ralph.ronnquist)]]></author>
			<pubDate>Wed, 13 Sep 2023 23:07:47 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44279#p44279</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44276#p44276</link>
			<description><![CDATA[<p>Yeah, like if you had this situation:</p><div class="codebox"><pre><code>$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        50G   20G   30G  40% /
/dev/sda2       450G   80G  270G  18% /home</code></pre></div><p>You&#039;d want a single 100GB <em>sparse</em> file, which still retains the 500GB capacity.</p>]]></description>
			<author><![CDATA[dummy@example.com (boughtonp)]]></author>
			<pubDate>Wed, 13 Sep 2023 22:18:25 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44276#p44276</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44268#p44268</link>
			<description><![CDATA[<div class="quotebox"><cite>boughtonp wrote:</cite><blockquote><div><div class="quotebox"><cite>zapper wrote:</cite><blockquote><div><p>Anyone know how to copy an entire hard drive onto a qcow2 image but with only the space being used as being counted?</p></div></blockquote></div><p>No, but I have spent a significant amount of time trying various solutions that <em>didn&#039;t</em> work, before eventually giving up and converting each partition to its own file, with qemu-image convert.</p></div></blockquote></div><p>Hmm... that method you mentioned didn&#039;t work for me, for some reason.</p><p>You know what I mean though, right?<br /><strong><br />Like say 200GB is used but 450 is available on hdd.</strong></p><p><strong>I want only the 200GB to be counted but expansion be possible at the same time.</strong></p><p>I am guessing you understand what I am saying, but felt I should clarify anyways. Especially for other people.</p><p>I might add to the first post...</p>]]></description>
			<author><![CDATA[dummy@example.com (zapper)]]></author>
			<pubDate>Wed, 13 Sep 2023 19:29:13 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44268#p44268</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44266#p44266</link>
			<description><![CDATA[<div class="quotebox"><cite>zapper wrote:</cite><blockquote><div><p>Anyone know how to copy an entire hard drive onto a qcow2 image but with only the space being used as being counted?</p></div></blockquote></div><p>No, but I have spent a significant amount of time trying various solutions that <em>didn&#039;t</em> work, before eventually giving up and converting each partition to its own file, with qemu-image convert.</p>]]></description>
			<author><![CDATA[dummy@example.com (boughtonp)]]></author>
			<pubDate>Wed, 13 Sep 2023 16:11:49 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44266#p44266</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44260#p44260</link>
			<description><![CDATA[<div class="quotebox"><cite>delgado wrote:</cite><blockquote><div><p><a href="https://unix.stackexchange.com/questions/541405/how-can-i-create-an-image-of-a-partition-ext4-and-later-mount-it-to-browse-re" rel="nofollow">https://unix.stackexchange.com/question … -browse-re</a></p><p>shows some examples using e2image, also for a qcow2- image. Not sure whether this works for your case too.</p></div></blockquote></div><p>Sadly no, but I did find something on that page, that might work.</p><p>I will just have to see though...</p>]]></description>
			<author><![CDATA[dummy@example.com (zapper)]]></author>
			<pubDate>Wed, 13 Sep 2023 05:30:00 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44260#p44260</guid>
		</item>
		<item>
			<title><![CDATA[Re: Question, about dd and/or qemu, for disk cloning]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=44252#p44252</link>
			<description><![CDATA[<p><a href="https://unix.stackexchange.com/questions/541405/how-can-i-create-an-image-of-a-partition-ext4-and-later-mount-it-to-browse-re" rel="nofollow">https://unix.stackexchange.com/question … -browse-re</a></p><p>shows some examples using e2image, also for a qcow2- image. Not sure whether this works for your case too.</p>]]></description>
			<author><![CDATA[dummy@example.com (delgado)]]></author>
			<pubDate>Tue, 12 Sep 2023 20:07:22 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=44252#p44252</guid>
		</item>
	</channel>
</rss>
