<?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: Howto : Resume a failed copy command where it left off</title>
	<atom:link href="http://hartvig.de/2008/howto-resume-a-failed-copy-command-where-it-left-off/feed/" rel="self" type="application/rss+xml" />
	<link>http://hartvig.de/2008/howto-resume-a-failed-copy-command-where-it-left-off/</link>
	<description>Personal homepage of Kaare Hartvig Jensen</description>
	<lastBuildDate>Mon, 02 Apr 2012 06:05:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Trevor Joynson</title>
		<link>http://hartvig.de/2008/howto-resume-a-failed-copy-command-where-it-left-off/#comment-97232</link>
		<dc:creator>Trevor Joynson</dc:creator>
		<pubDate>Fri, 30 Mar 2012 05:44:14 +0000</pubDate>
		<guid isPermaLink="false">http://hartvig.de/?p=32#comment-97232</guid>
		<description>Using a blocksize other than 1 helped me out with CPU usage quite a bit, and acted as a nice buffer across my network transfers, ala mbuf esque. Sorry to spam your blog, but here&#039;s my final variation if anyone&#039;s interested:

#!/bin/bash -e

# Blocksize to truncate to and buffer by
BS=${BS:-4096}

death() { echo &quot;$0:&quot; &quot;$@&quot; &gt;&amp;2; exit 1; }

[ $# -eq 2 ] &#124;&#124; death &quot;Usage: $0 original copy&quot; 
SRC=&quot;$1&quot;; DST=&quot;$2&quot;

# Got SRC?
[ -f &quot;$SRC&quot; ] &#124;&#124; death &quot;$SRC: No such file&quot; 

# Calculate the number of bytes to skip before we start copying. Default to zero.
SKIP=0; [ ! -f &quot;$DST&quot; ] &#124;&#124; SKIP=$(( $(wc --bytes &quot;$DST&quot; &#124; awk &#039;{print $1}&#039; ) / $BS ))

# Do the actual copying.
echo dd if=&quot;$SRC&quot; of=&quot;$DST&quot; conv=notrunc bs=$BS skip=&quot;$SKIP&quot; seek=&quot;$SKIP&quot;</description>
		<content:encoded><![CDATA[<p>Using a blocksize other than 1 helped me out with CPU usage quite a bit, and acted as a nice buffer across my network transfers, ala mbuf esque. Sorry to spam your blog, but here&#8217;s my final variation if anyone&#8217;s interested:</p>
<p>#!/bin/bash -e</p>
<p># Blocksize to truncate to and buffer by<br />
BS=${BS:-4096}</p>
<p>death() { echo &#8220;$0:&#8221; &#8220;$@&#8221; &gt;&amp;2; exit 1; }</p>
<p>[ $# -eq 2 ] || death &#8220;Usage: $0 original copy&#8221;<br />
SRC=&#8221;$1&#8243;; DST=&#8221;$2&#8243;</p>
<p># Got SRC?<br />
[ -f "$SRC" ] || death &#8220;$SRC: No such file&#8221; </p>
<p># Calculate the number of bytes to skip before we start copying. Default to zero.<br />
SKIP=0; [ ! -f "$DST" ] || SKIP=$(( $(wc &#8211;bytes &#8220;$DST&#8221; | awk &#8216;{print $1}&#8217; ) / $BS ))</p>
<p># Do the actual copying.<br />
echo dd if=&#8221;$SRC&#8221; of=&#8221;$DST&#8221; conv=notrunc bs=$BS skip=&#8221;$SKIP&#8221; seek=&#8221;$SKIP&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

