{"id":14,"date":"2014-03-22T10:54:00","date_gmt":"2014-03-22T10:54:00","guid":{"rendered":""},"modified":"2016-02-25T18:09:01","modified_gmt":"2016-02-25T18:09:01","slug":"how-to-backup-your-raspberry-pi-sd-card","status":"publish","type":"post","link":"https:\/\/www.root42.de\/blog\/?p=14","title":{"rendered":"How to backup your Raspberry Pi SD-Card"},"content":{"rendered":"<p>In the following I will explain on how you can backup your Pi&#8217;s SD-card, so that whenever it breaks down, you can simply restore the backup image to a fresh SD-Card. This may also help with tinkering, when you totally screwed up your Pi&#8217;s Linux-installation. I will explain the first step specifically for Mac OS X, but you can do this similarly on other UNIXes and Linux, by using the mount and umount commands.<\/p>\n<p>So, shut down your Pi using the command <span style=\"font-family: Courier New, Courier, monospace;\">sudo shutdown -h now<\/span>&nbsp;and remove the SD-card after the Pi has done so. Take the card and insert it into your Mac&#8217;s SD-card slot.<\/p>\n<p>First of all, we need to find out which disk device has been assigned to the card. We can do this with <span style=\"font-family: Courier New, Courier, monospace;\">diskutil list<\/span>:<\/p>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">user@mymacintosh:~ $ diskutil list  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">\/dev\/disk0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">&nbsp;&nbsp; #: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TYPE NAME&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SIZE &nbsp; &nbsp; &nbsp; IDENTIFIER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">&nbsp;&nbsp; 0:&nbsp; &nbsp; &nbsp; GUID_partition_scheme&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *512.1 GB &nbsp; disk0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">&nbsp;&nbsp; 1:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EFI EFI &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 209.7 MB &nbsp; disk0s1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">&nbsp;&nbsp; 2:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Apple_HFS M4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 511.1 GB &nbsp; disk0s2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">&nbsp;&nbsp; 3: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Apple_Boot Recovery HD &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 784.2 MB &nbsp; disk0s3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">\/dev\/disk1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">&nbsp;&nbsp; #: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TYPE NAME&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SIZE &nbsp; &nbsp; &nbsp; IDENTIFIER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">&nbsp;&nbsp; 0: &nbsp; &nbsp; FDisk_partition_scheme&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *15.9 GB&nbsp; &nbsp; disk1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">&nbsp;&nbsp; 1: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Windows_FAT_32 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 58.7 MB&nbsp; &nbsp; disk1s1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">&nbsp;&nbsp; 2:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Linux &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 15.9 GB&nbsp; &nbsp; disk1s2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<p>Then unmount the card using <span style=\"font-family: Courier New, Courier, monospace;\">diskutil unmountDisk<\/span>:<\/p>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">user@mymacintosh:~ $ diskutil umountDisk \/dev\/disk1  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">Unmount of all volumes on disk1 was successful&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<p>Next we will use dd to produce an image, which we can compress using bzip2, or pbzip2 for more performance. You can use MacPorts to install pbzip2.<\/p>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">user@mymacintosh:~ $ sudo dd if=\/dev\/disk1 | pbzip2 &gt; raspberry_pi_$(date &#8220;+%Y-%m-%d&#8221;).img.bz2&nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">31116288+0 records in&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">31116288+0 records out &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">15931539456 bytes transferred in 2347.692010 secs (6786043 bytes\/sec)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<p>Restoring the image is also easy:<\/p>\n<div style=\"background-color: black; color: whitesmoke; font-family: fixed-7x14, monospace; font-size: 14px;\">user@mymacintosh:~ $ bunzip2 raspberry_pi_2014-03-22.img.bz2 | sudo dd of=\/dev\/disk1 &nbsp; &nbsp; &nbsp;<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In the following I will explain on how you can backup your Pi&#8217;s SD-card, so that whenever it breaks down, you can simply restore the backup image to a fresh SD-Card. This may also help with tinkering, when you totally screwed up your Pi&#8217;s Linux-installation. I will explain the first step specifically for Mac OS &hellip; <a href=\"https:\/\/www.root42.de\/blog\/?p=14\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to backup your Raspberry Pi SD-Card&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,5,3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14"}],"collection":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14"}],"version-history":[{"count":1,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14\/revisions"}],"predecessor-version":[{"id":198,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14\/revisions\/198"}],"wp:attachment":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}