<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Copy hard disk or partition image to another system using a network and netcat (nc)</title> <atom:link href="http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Scott</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-172236</link> <dc:creator>Scott</dc:creator> <pubDate>Sat, 02 Jul 2011 13:32:44 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-172236</guid> <description>Great site and follow through by everybody. I wonder about the output destination partition/file. Is the output partition created before the
dd of=/dev/sdb
if so how is this done?
Can you instead just send this to a file on the receiving end?
dd of=/tftp/HOSTA.img
So far the discussion is about device or hard drive NOT a partition.
If one wants to make a bootable image of the source partition wouldn&#039;t you copy the?
if=/dev/sda1 (if that is it).
Thanks everybody.</description> <content:encoded><![CDATA[<p>Great site and follow through by everybody. I wonder about the output destination partition/file. Is the output partition created before the<br
/> dd of=/dev/sdb<br
/> if so how is this done?<br
/> Can you instead just send this to a file on the receiving end?<br
/> dd of=/tftp/HOSTA.img</p><p>So far the discussion is about device or hard drive NOT a partition.<br
/> If one wants to make a bootable image of the source partition wouldn&#8217;t you copy the?<br
/> if=/dev/sda1 (if that is it).</p><p>Thanks everybody.</p> ]]></content:encoded> </item> <item><title>By: David Bain</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-156167</link> <dc:creator>David Bain</dc:creator> <pubDate>Sun, 23 May 2010 10:52:14 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-156167</guid> <description>Hmmmm.. when I follow these instructions everything works except it appears to &quot;hang&quot; when no more data is left to pass from the source machine. I added pv to the command &quot;chain&quot;, as noted above, so I pretty much know when no more data is being passed. Isn&#039;t it supposed to close the connection once all the bytes have been moved?</description> <content:encoded><![CDATA[<p>Hmmmm.. when I follow these instructions everything works except it appears to &#8220;hang&#8221; when no more data is left to pass from the source machine. I added pv to the command &#8220;chain&#8221;, as noted above, so I pretty much know when no more data is being passed. Isn&#8217;t it supposed to close the connection once all the bytes have been moved?</p> ]]></content:encoded> </item> <item><title>By: Salah</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-156030</link> <dc:creator>Salah</dc:creator> <pubDate>Sat, 15 May 2010 13:25:54 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-156030</guid> <description>I see that everyone is recommending dd/nc but I wonder if there&#039;s another solution that provide workarounds for network problems (unstable connections =&gt; disconnect/resume, bandwidth limitation =&gt; schedule,.. etc). While I&#039;m not if it&#039;s possible to use dd/nc that way.
I don&#039;t mind spending days copying a harddisk from a remote location to another if that will go automatically and error free. Anyone?</description> <content:encoded><![CDATA[<p>I see that everyone is recommending dd/nc but I wonder if there&#8217;s another solution that provide workarounds for network problems (unstable connections =&gt; disconnect/resume, bandwidth limitation =&gt; schedule,.. etc). While I&#8217;m not if it&#8217;s possible to use dd/nc that way.</p><p>I don&#8217;t mind spending days copying a harddisk from a remote location to another if that will go automatically and error free. Anyone?</p> ]]></content:encoded> </item> <item><title>By: Ksh</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-153987</link> <dc:creator>Ksh</dc:creator> <pubDate>Sat, 27 Feb 2010 21:41:18 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-153987</guid> <description>Why not gzip? In my experience bzip2 take 3-4 times more cpu cycles than &quot;gzip -3&quot; ;on the other side compression factor could be only 10-20% better.</description> <content:encoded><![CDATA[<p>Why not gzip? In my experience bzip2 take 3-4 times more cpu cycles than &#8220;gzip -3&#8243; ;on the other side compression factor could be only 10-20% better.</p> ]]></content:encoded> </item> <item><title>By: Hari</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-153176</link> <dc:creator>Hari</dc:creator> <pubDate>Thu, 28 Jan 2010 02:48:15 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-153176</guid> <description>I meant to say &quot;hostA&quot; (ie., the source device is a lowend device like iphone)</description> <content:encoded><![CDATA[<p>I meant to say &#8220;hostA&#8221; (ie., the source device is a lowend device like iphone)</p> ]]></content:encoded> </item> <item><title>By: Hari</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-153173</link> <dc:creator>Hari</dc:creator> <pubDate>Thu, 28 Jan 2010 02:32:28 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-153173</guid> <description>Thanks for putting this together. This is a good alternative to have in case ssh option doesn&#039;t workout for some reason. This should also be better than ssh when the hostB is a very lowend device (like iphone).</description> <content:encoded><![CDATA[<p>Thanks for putting this together. This is a good alternative to have in case ssh option doesn&#8217;t workout for some reason. This should also be better than ssh when the hostB is a very lowend device (like iphone).</p> ]]></content:encoded> </item> <item><title>By: richard</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-153107</link> <dc:creator>richard</dc:creator> <pubDate>Sun, 24 Jan 2010 08:45:32 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-153107</guid> <description>An excellent HOWTO. Thank you. Take heed of &#039;me&#039; advice. bzip2 will cause a cpu/memory bottleneck on old machines and under utilise the network. I also found using pv to add a progress meter was useful:
Target host (HOST B):
nc -p 2222 -l -vv &#124; pv -r &#124; dd of=/dev/sda bs=16M
Source host (HOST A):
dd if=/dev/sda bs=16M &#124; nc  2222</description> <content:encoded><![CDATA[<p>An excellent HOWTO. Thank you. Take heed of &#8216;me&#8217; advice. bzip2 will cause a cpu/memory bottleneck on old machines and under utilise the network. I also found using pv to add a progress meter was useful:<br
/> Target host (HOST B):<br
/> nc -p 2222 -l -vv | pv -r | dd of=/dev/sda bs=16M</p><p>Source host (HOST A):<br
/> dd if=/dev/sda bs=16M | nc  2222</p> ]]></content:encoded> </item> <item><title>By: Paul Johnson</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-149489</link> <dc:creator>Paul Johnson</dc:creator> <pubDate>Tue, 14 Jul 2009 20:33:21 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-149489</guid> <description>I have new version of netcat.  I wonder if there is a way to use something like the bs option with this new style of command in order to speed it up.  Adapting your instruction to my case, here is what I do:
On the TARGET machine, 129.237.61.XX, make sure port 12345 is unfirewalled. Then set netcat to grab the incoming on 12345 and divert it to disk /dev/sdb. Can also replace with particular partition /dev/sdb2:
nc -l 12345 &#124; bzip2 -d &gt; /dev/sdb
After that, go to the SOURCE machine and compress the source disk /dev/sda and pipe it to through nc over to the other system:
bzip2 -c /dev/sda &#124; nc 129.237.61.XX 12345
That does work, but not speedy.
Also, in your instructions, I wonder if you ought to add some information on whether this should be done on a &quot;live&quot; (mounted) file system.  From what I can tell, one ought to do this only after booting from a rescue disk or external drive or some sort.</description> <content:encoded><![CDATA[<p>I have new version of netcat.  I wonder if there is a way to use something like the bs option with this new style of command in order to speed it up.  Adapting your instruction to my case, here is what I do:</p><p>On the TARGET machine, 129.237.61.XX, make sure port 12345 is unfirewalled. Then set netcat to grab the incoming on 12345 and divert it to disk /dev/sdb. Can also replace with particular partition /dev/sdb2:</p><p>nc -l 12345 | bzip2 -d &gt; /dev/sdb</p><p>After that, go to the SOURCE machine and compress the source disk /dev/sda and pipe it to through nc over to the other system:</p><p>bzip2 -c /dev/sda | nc 129.237.61.XX 12345</p><p>That does work, but not speedy.</p><p>Also, in your instructions, I wonder if you ought to add some information on whether this should be done on a &#8220;live&#8221; (mounted) file system.  From what I can tell, one ought to do this only after booting from a rescue disk or external drive or some sort.</p> ]]></content:encoded> </item> <item><title>By: Me</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-148694</link> <dc:creator>Me</dc:creator> <pubDate>Mon, 25 May 2009 17:32:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-148694</guid> <description>Just skipping the bzip2, is MUCH faster on slower systems..</description> <content:encoded><![CDATA[<p>Just skipping the bzip2, is MUCH faster on slower systems..</p> ]]></content:encoded> </item> <item><title>By: casparoo</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-148391</link> <dc:creator>casparoo</dc:creator> <pubDate>Fri, 01 May 2009 05:38:18 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-148391</guid> <description>How can I copy  a hard disk image of a Windows machine to a Linux machine through network ( using netcat and dd). Could you please provide the details. Thanks in advance...</description> <content:encoded><![CDATA[<p>How can I copy  a hard disk image of a Windows machine to a Linux machine through network ( using netcat and dd). Could you please provide the details. Thanks in advance&#8230;</p> ]]></content:encoded> </item> <item><title>By: rickx</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-147752</link> <dc:creator>rickx</dc:creator> <pubDate>Thu, 19 Mar 2009 07:37:08 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-147752</guid> <description>A bit messy tackling errors in the instructions, but doing
sudo su
nc -l -p 2222 &#124; dd of=/dev/sda bs=16M
on the receiver (192.168.0.2) and
sudo su
dd if=/dev/sda bs=16M &#124; nc 192.168.0.2 2222
on the source (192.168.0.1) works.
Use
ifconfig eth0 192.168.0.1[or 2] netmask 255.255.255.0
to configure the nics from the shell on the fly.
Problem is grub then: the entries with GUIDs will not work, so edit the menu.list before rebooting or you&#039;ll get error 2.
Thanks anyway.</description> <content:encoded><![CDATA[<p>A bit messy tackling errors in the instructions, but doing<br
/> sudo su<br
/> nc -l -p 2222 | dd of=/dev/sda bs=16M<br
/> on the receiver (192.168.0.2) and<br
/> sudo su<br
/> dd if=/dev/sda bs=16M | nc 192.168.0.2 2222<br
/> on the source (192.168.0.1) works.<br
/> Use<br
/> ifconfig eth0 192.168.0.1[or 2] netmask 255.255.255.0<br
/> to configure the nics from the shell on the fly.<br
/> Problem is grub then: the entries with GUIDs will not work, so edit the menu.list before rebooting or you&#8217;ll get error 2.<br
/> Thanks anyway.</p> ]]></content:encoded> </item> <item><title>By: Florian</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-146578</link> <dc:creator>Florian</dc:creator> <pubDate>Tue, 06 Jan 2009 01:42:18 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-146578</guid> <description>The command works fine, but if you use netcat to make a diskdump of two directly connected machines, you should avoid the compression, because it will slow down everything.
Works fine for the following scenario:
Host A  Host B (with twisted pair)</description> <content:encoded><![CDATA[<p>The command works fine, but if you use netcat to make a diskdump of two directly connected machines, you should avoid the compression, because it will slow down everything.</p><p>Works fine for the following scenario:<br
/> Host A  Host B (with twisted pair)</p> ]]></content:encoded> </item> <item><title>By: Hannes</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-144850</link> <dc:creator>Hannes</dc:creator> <pubDate>Thu, 04 Sep 2008 20:30:24 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-144850</guid> <description>Thanks a lot for this article.
But like Anuarag said, &quot;hostA&quot; should be &quot;hostB&quot; here:&lt;blockquote&gt;(on hostA, type) # bzip2 -c /dev/sda &#124; netcat hostA 2222&lt;/blockquote&gt; We connect not to ourself, yes? :)</description> <content:encoded><![CDATA[<p>Thanks a lot for this article.<br
/> But like Anuarag said, &#8220;hostA&#8221; should be &#8220;hostB&#8221; here:<br
/><blockquote>(on hostA, type) # bzip2 -c /dev/sda | netcat hostA 2222</p></blockquote><p> We connect not to ourself, yes? :)</p> ]]></content:encoded> </item> <item><title>By: S</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-144749</link> <dc:creator>S</dc:creator> <pubDate>Sat, 23 Aug 2008 02:10:42 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-144749</guid> <description>in response to #11(ben);
why would you first netcat the data uncompressed and only then compress it into an image?</description> <content:encoded><![CDATA[<p>in response to #11(ben);</p><p>why would you first netcat the data uncompressed and only then compress it into an image?</p> ]]></content:encoded> </item> <item><title>By: chains</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-144646</link> <dc:creator>chains</dc:creator> <pubDate>Wed, 13 Aug 2008 16:10:30 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-144646</guid> <description>I tried what Ben suggested:
# BACKUP - to backupserver (192.168.1.1)
nc -p 2222 -l &#124; bzip2 -c &gt; Image.bz2
# BACKUP - from clienthost (192.168.1.2)
dd if=/dev/sda bs=16M &#124; nc 192.168.1.1 2222
# RESTORE - to clienthost (192.168.1.2)
nc -p 2222 -l &gt; /dev/sda
# RESTORE - from backupserver (192.168.1.1)
dd if=Image.bz2 bs=16M &#124; bunzip2 -c &#124; nc 192.168.1.2 2222
but when restoring i&#039;m getting the error:
&quot;bunzip2: (stdin) is not a bzip2 file.&quot;
Any suggestions?</description> <content:encoded><![CDATA[<p>I tried what Ben suggested:</p><p># BACKUP &#8211; to backupserver (192.168.1.1)<br
/> nc -p 2222 -l | bzip2 -c &gt; Image.bz2<br
/> # BACKUP &#8211; from clienthost (192.168.1.2)<br
/> dd if=/dev/sda bs=16M | nc 192.168.1.1 2222</p><p># RESTORE &#8211; to clienthost (192.168.1.2)<br
/> nc -p 2222 -l &gt; /dev/sda<br
/> # RESTORE &#8211; from backupserver (192.168.1.1)<br
/> dd if=Image.bz2 bs=16M | bunzip2 -c | nc 192.168.1.2 2222</p><p>but when restoring i&#8217;m getting the error:<br
/> &#8220;bunzip2: (stdin) is not a bzip2 file.&#8221;</p><p>Any suggestions?</p> ]]></content:encoded> </item> <item><title>By: Brian Trauger</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-144154</link> <dc:creator>Brian Trauger</dc:creator> <pubDate>Wed, 25 Jun 2008 04:51:54 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-144154</guid> <description>This looks very helpful. Can I also specify just 1 partition instead of the whole drive? I have a dual-boot with Xp and want to just backup the Windows partition.. Or should I just use partimage?</description> <content:encoded><![CDATA[<p>This looks very helpful. Can I also specify just 1 partition instead of the whole drive? I have a dual-boot with Xp and want to just backup the Windows partition.. Or should I just use partimage?</p> ]]></content:encoded> </item> <item><title>By: Ben</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-143307</link> <dc:creator>Ben</dc:creator> <pubDate>Fri, 28 Mar 2008 14:08:56 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-143307</guid> <description>I don&#039;t see any good about using ssh in local network and it would produce extra traffic. Here&#039;s my contrib to backup and restore a linux parition:
# BACKUP - to backupserver (192.168.1.1)
nc -p 2222 -l &#124; bzip2 -c &gt; Image.bz2
# BACKUP - from clienthost (192.168.1.2)
dd if=/dev/sda bs=16M &#124; nc 192.168.1.1 2222
# RESTORE - to clienthost (192.168.1.2)
nc -p 2222 -l &gt; /dev/sda
# RESTORE - from backupserver (192.168.1.1)
dd if=Image.bz2 bs=16M &#124; bunzip2 -c &#124; nc 192.168.1.2 2222</description> <content:encoded><![CDATA[<p>I don&#8217;t see any good about using ssh in local network and it would produce extra traffic. Here&#8217;s my contrib to backup and restore a linux parition:</p><p># BACKUP &#8211; to backupserver (192.168.1.1)<br
/> nc -p 2222 -l | bzip2 -c &gt; Image.bz2<br
/> # BACKUP &#8211; from clienthost (192.168.1.2)<br
/> dd if=/dev/sda bs=16M | nc 192.168.1.1 2222</p><p># RESTORE &#8211; to clienthost (192.168.1.2)<br
/> nc -p 2222 -l &gt; /dev/sda<br
/> # RESTORE &#8211; from backupserver (192.168.1.1)<br
/> dd if=Image.bz2 bs=16M | bunzip2 -c | nc 192.168.1.2 2222</p> ]]></content:encoded> </item> <item><title>By: The Cog</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-142784</link> <dc:creator>The Cog</dc:creator> <pubDate>Tue, 05 Feb 2008 08:46:33 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-142784</guid> <description>Useful hint, thanks.
There is some confusion betwen host A and B though. All the examples are copying from B to A, but the headings: &quot;Command to type on host...&quot; indicate you are copying from A to B.
Nit-picking, I know.</description> <content:encoded><![CDATA[<p>Useful hint, thanks.<br
/> There is some confusion betwen host A and B though. All the examples are copying from B to A, but the headings: &#8220;Command to type on host&#8230;&#8221; indicate you are copying from A to B.<br
/> Nit-picking, I know.</p> ]]></content:encoded> </item> <item><title>By: g4b</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-142671</link> <dc:creator>g4b</dc:creator> <pubDate>Mon, 28 Jan 2008 15:01:42 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-142671</guid> <description>-l also takes a host as option, so if you really want to be sure, no one else just streams in your data you can add like
nc -l HostSource -p 2222...
also maybe update the whole thing to use &quot;HostSource&quot; and &quot;HostDest&quot; because HostA and HostB is a bit confusing maybe.
thanx for the tutorial, g4b</description> <content:encoded><![CDATA[<p>-l also takes a host as option, so if you really want to be sure, no one else just streams in your data you can add like<br
/> nc -l HostSource -p 2222&#8230;</p><p>also maybe update the whole thing to use &#8220;HostSource&#8221; and &#8220;HostDest&#8221; because HostA and HostB is a bit confusing maybe.</p><p>thanx for the tutorial, g4b</p> ]]></content:encoded> </item> <item><title>By: Anuarag</title><link>http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-140953</link> <dc:creator>Anuarag</dc:creator> <pubDate>Fri, 31 Aug 2007 04:08:42 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html#comment-140953</guid> <description>Thanks for this guide.
I am confused!! on the host A (i.e. source disk host) command to be typed is:
&lt;i&gt; # bzip2 -c /dev/sda &#124; netcat hostA 2222 &lt;/i&gt;
Should it be hostA or hostB.
Similarly I am confused about the commands given for the new version of nc: It seems to me commands for host A and B exchanged?
Please correct me.
Thanks
Anurag</description> <content:encoded><![CDATA[<p>Thanks for this guide.</p><p>I am confused!! on the host A (i.e. source disk host) command to be typed is:<br
/> <i> # bzip2 -c /dev/sda | netcat hostA 2222 </i></p><p>Should it be hostA or hostB.</p><p>Similarly I am confused about the commands given for the new version of nc: It seems to me commands for host A and B exchanged?</p><p>Please correct me.</p><p>Thanks<br
/> Anurag</p> ]]></content:encoded> </item> </channel> </rss>
