<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>restore &#8211; ZZ &amp; Joa</title>
	<atom:link href="https://blog.znjoa.com/tag/restore/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.znjoa.com</link>
	<description>Work &#38; Life</description>
	<lastBuildDate>Mon, 17 May 2021 00:22:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://blog.znjoa.com/wp-content/uploads/2022/11/cropped-DALL·E-2022-11-23-19.39.49-USSR-style-poster-of-VR-and-AR-150x150.jpg</url>
	<title>restore &#8211; ZZ &amp; Joa</title>
	<link>https://blog.znjoa.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">192961540</site>	<item>
		<title>Backing up and restoring Raspberry Pi SD card</title>
		<link>https://blog.znjoa.com/2021/05/17/backing-up-and-restoring-raspberry-pi-sd-card/</link>
					<comments>https://blog.znjoa.com/2021/05/17/backing-up-and-restoring-raspberry-pi-sd-card/#respond</comments>
		
		<dc:creator><![CDATA[Zz]]></dc:creator>
		<pubDate>Mon, 17 May 2021 00:06:36 +0000</pubDate>
				<category><![CDATA[RPi]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[pv]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[rpi]]></category>
		<category><![CDATA[watch_progress]]></category>
		<guid isPermaLink="false">http://192.168.0.186/?p=67</guid>

					<description><![CDATA[This shows how to do it on MacOS. It&#8217;s quite straightforward using dd. Backup Remote way&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[
<p><em>This shows how to do it on MacOS. It&#8217;s quite straightforward using <code class="EnlighterJSRAW" data-enlighter-language="generic">dd</code>.</em></p>



<h5 class="wp-block-heading">Backup</h5>



<h6 class="wp-block-heading">Remote way</h6>



<p>If you prefer to do it remotely via SSH, use this command:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">ssh root@your_rpi_ip "dd if=/dev/your_rpi_sd_card bs=1m | gzip -1 -" | pv | dd of=rpi.gz</pre>



<p><code data-enlighter-language="generic" class="EnlighterJSRAW">your_rpi_ip</code>&nbsp;can be obtained by <code data-enlighter-language="generic" class="EnlighterJSRAW">hostname -I</code>&nbsp;. <code data-enlighter-language="generic" class="EnlighterJSRAW">if</code>&nbsp;is followed by the your sd card path when mounted on RPi, which can be obtained by <code data-enlighter-language="generic" class="EnlighterJSRAW">lsblk -p</code>&nbsp;(make sure the disk you believe to be the SD card matches the size of your SD card!). <code data-enlighter-language="generic" class="EnlighterJSRAW">pv</code>&nbsp;is used here so that the progress of <code data-enlighter-language="generic" class="EnlighterJSRAW">dd</code> can be constantly checked. If you don&#8217;t have it, install it using <code data-enlighter-language="generic" class="EnlighterJSRAW">brew install pv</code> if you have homebrew installed.&nbsp;</p>



<p>Depending on the size of your SD card and your connection speed, it could take some time. So go and get a coffee!</p>



<h6 class="wp-block-heading">Local way (RPi end)</h6>



<p>Similarly, you should be able to dd locally on <code data-enlighter-language="generic" class="EnlighterJSRAW">RPi</code> then scp the image to your PC/Mac. As a result, the <code data-enlighter-language="generic" class="EnlighterJSRAW">SSH</code> part will be stripped away:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">dd if=/dev/your_rpi_sd_card bs=1m | gzip -1 - | pv | dd of=rpi.gz</pre>



<p>After it&#8217;s done, you can use <code data-enlighter-language="generic" class="EnlighterJSRAW">scp</code> to transfer the image file to your PC/Mac.</p>



<h6 class="wp-block-heading">Local way (PC/Mac end)</h6>



<p>This is recommended since it&#8217;s faster due to the fact that the SD card is physically connected to your PC/Mac.</p>



<ol class="wp-block-list"><li>Remove the SD card from your RPi and connect it to your computer.</li><li>Check the disk name on your Mac using: <code data-enlighter-language="generic" class="EnlighterJSRAW">diskutil list</code>. Similarly, double check the disk size so that you don&#8217;t make a mistake.</li><li>Same as the local way on RPi end: <code data-enlighter-language="generic" class="EnlighterJSRAW">dd if=/dev/your_rpi_sd_card bs=1m | gzip -1 - | pv | dd of=rpi.gz</code>.</li></ol>



<hr class="wp-block-separator is-style-wide"/>



<h5 class="wp-block-heading">Restoring</h5>



<p>It&#8217;s also pretty straight-forward for the restoring. The steps are:</p>



<ol class="wp-block-list"><li>Connect the SD card to your computer.</li><li>Check the name of the disk using the method mentioned above</li><li>Unmount (not eject) the SD card by <code data-enlighter-language="generic" class="EnlighterJSRAW">diskutil unmountDisk /dev/disk_nr</code></li><li>Burn the image file into your SD card using: <code data-enlighter-language="generic" class="EnlighterJSRAW">gzip -dc yourRPiImage | pv | sudo dd of=/dev/disk_nr bs=1m</code></li></ol>



<p>After another coffee, you can plug your SD card back into your RPi. Enjoy your back-to-life RPi.</p>



<h5 class="wp-block-heading">P.S.</h5>



<p>Instead of using <code data-enlighter-language="generic" class="EnlighterJSRAW">pv</code>, <code data-enlighter-language="generic" class="EnlighterJSRAW">progress</code> and <code data-enlighter-language="generic" class="EnlighterJSRAW">watch</code> can be used together to check the status. So run the above commands without <code data-enlighter-language="generic" class="EnlighterJSRAW">pv</code>, and open another terminal and run <code data-enlighter-language="generic" class="EnlighterJSRAW">watch progress</code>, you now even have a progress bar!</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.znjoa.com/2021/05/17/backing-up-and-restoring-raspberry-pi-sd-card/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">67</post-id>	</item>
	</channel>
</rss>
