{"id":6941,"date":"2017-02-22T09:11:24","date_gmt":"2017-02-22T09:11:24","guid":{"rendered":"https:\/\/stevepedwards.today\/DebianAdmin\/?p=6941"},"modified":"2017-02-22T09:11:24","modified_gmt":"2017-02-22T09:11:24","slug":"backing-up-working-picam-images-over-the-net-with-dd-and-netcat","status":"publish","type":"post","link":"https:\/\/stevepedwards.today\/DebianAdmin\/backing-up-working-picam-images-over-the-net-with-dd-and-netcat\/","title":{"rendered":"Backing Up Working Picam Images Over the Net With dd and Netcat"},"content":{"rendered":"<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_6941\" class=\"pvc_stats all  \" data-element-id=\"6941\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p>I recently updated my Picams to the latest Raspbian firmware after a camera module change, using:<\/p>\n<p><span style=\"color: #0000ff;\">sudo rpi-update<\/span><\/p>\n<p>Once updated and working, complete with changed passwords etc. it is inconvenient to bring these units down physically to take the card out - one is in the garage - to DD clone the micro SD card images locally, so send the image direct from the working camera instead using netcat.<\/p>\n<p>Get the IP of the target server:<\/p>\n<p><span style=\"color: #0000ff;\">ifconfig<\/span><br \/>\n<span style=\"color: #ff0000;\">eth0 Link encap:Ethernet HWaddr 00:23:54:3a:eb:9a \u00a0inet addr:192.168.1.15<\/span><\/p>\n<p>Use netcat to send\u00a0the images over your net by setting up a listening server FIRST - any port number you like - on the target where the image is to be saved e.g:<\/p>\n<p><span style=\"color: #0000ff;\">sudo apt install pv<\/span><\/p>\n<p>stevee@hppavmint ~ $ <span style=\"color: #0000ff;\">netcat -l -p 9000 | pv | dd of=pi.image<\/span><\/p>\n<p>Then ssh into the Pi and send the full bootable SD card image after you know the device id:<\/p>\n<p>stevee@pirear ~ $ <span style=\"color: #0000ff;\">sudo fdisk -l<\/span><br \/>\n<span style=\"color: #ff0000;\">[sudo] password for stevee:<\/span><\/p>\n<p><span style=\"color: #ff0000;\">Disk <strong>\/dev\/mmcblk0<\/strong>: 7948 MB, 7948206080 bytes<\/span><\/p>\n<p>stevee@pirear ~ $ <span style=\"color: #0000ff;\">sudo dd if=\/dev\/mmcblk0 | netcat 192.168.1.15 9000<\/span><br \/>\n[sudo] password for stevee:<\/p>\n<p>Check on progress periodically in a third terminal to see the image grow:<\/p>\n<p><span style=\"color: #0000ff;\">netcat -l -p 9000 | pv | dd of=piroad.img<\/span><br \/>\n<span style=\"color: #ff0000;\">533MB 0:03:23 [3.32MB\/s]<\/span><\/p>\n<p>stevee@hppavmint ~ $ <span style=\"color: #0000ff;\">ll piroad.img<\/span><br \/>\n<span style=\"color: #ff0000;\">-rw-r--r-- 1 stevee stevee 6355204096 Feb 22 09:06 pi.image<\/span><\/p>\n<p>When done, you see the summary on the Pi:<\/p>\n<p>stevee@pirear ~ $ sudo dd if=\/dev\/mmcblk0 | netcat 192.168.1.5 9000<br \/>\n<span style=\"color: #ff0000;\">[sudo] password for stevee: <\/span><br \/>\n<span style=\"color: #ff0000;\">15523840+0 records in<\/span><br \/>\n<span style=\"color: #ff0000;\">15523840+0 records out<\/span><br \/>\n<span style=\"color: #ff0000;\">7948206080 bytes (7.9 GB) copied, 1009.06 s, 7.9 MB\/s<\/span><\/p>\n<p>It took 16 minutes.<\/p>\n<p>As I named the image without a \"typical\" extension - even though Linux doesn't <em>need<\/em> one - (duh!) I'll rename it to Piroad.img so it is better recognised for future general *.img searches and in the GUI apps for creating new SD cards in future using USB Writer.<\/p>\n<p><span style=\"color: #0000ff;\">mv -v pi.image piroad.img<\/span><\/p>\n<p>You can check it mounts locally\u00a0with Disk Image Mounter:<\/p>\n<p><a href=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2017\/02\/Piimg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-6946\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2017\/02\/Piimg.png\" alt=\"\" width=\"911\" height=\"980\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_6941\" class=\"pvc_stats all  \" data-element-id=\"6941\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p>I recently updated my Picams to the latest Raspbian firmware after a camera module change, using: sudo rpi-update Once updated and working, complete with changed passwords etc. it is inconvenient to bring these units down physically to take the card out - one is in the garage - to DD clone the micro SD card <a href=\"https:\/\/stevepedwards.today\/DebianAdmin\/backing-up-working-picam-images-over-the-net-with-dd-and-netcat\/\" class=\"more-link\">...<span class=\"screen-reader-text\">\u00a0 Backing Up Working Picam Images Over the Net With dd and Netcat<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,2],"tags":[],"class_list":["post-6941","post","type-post","status-publish","format-standard","hentry","category-uncategorised","category-uncategorized"],"a3_pvc":{"activated":true,"total_views":1,"today_views":0},"_links":{"self":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts\/6941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/comments?post=6941"}],"version-history":[{"count":0,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts\/6941\/revisions"}],"wp:attachment":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/media?parent=6941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/categories?post=6941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/tags?post=6941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}