I see a lot of backup instructions like this: How do I backup my Raspberry Pi?

...involving the command line in OSX. But can't I just use the OSX "Disk Utility" to create a "New Image" from the partition on my SD card? Is that not a recoverable backup? And so much easier with a GUI! So there must be something wrong with it...?

up vote 12 down vote accepted

Unix dd

I'm boring and use the ancient dd command in OS X.

  1. Plug your sdcard into your Mac
  2. Open Disk Utility
  3. Select your sdcard and take note of its Device name
    (Mine is usually /dev/disk2) disk utility
  4. Open Terminal
  5. Find out your username by typing whoami and pressing the Return key.
  6. (REPLACE disk AND sjobs WITH THE CORRECT VALUES BEFORE RUNNING!!!)
    (FAILURE TO SET CORRECT VALUES MAY CAUSE DATA LOSS!!!)
    Type sudo dd if=/dev/disk2 of=/Users/sjobs/Desktop/raspberrypi-backup.img and hit Return
  7. Type in your password and press Return again
  8. Go answer questions on Stack Exchange until dd finishes.
    You'll know when it's done, because dd will tell you how much it copied and give control of the command prompt back to you.

Linux

You can also do this on Linux:

  • Use gnome-disks instead of Disk Utility
  • Use /dev/mccblk0 instead of /dev/disk2 gnome-disks
  • Use gnome-terminal instead of Terminal
  • Use /home/sjobs/ instead of /Users/sjobs
  • YOU STILL NEED TO PICK THE RIGHT DISK AND USERNAME!!!

Since Linux can read Raspbian's ext4 filesystem, there's probably a better way to back it up on Linux, maybe with some of tools that clonezilla uses.

  • 1
    As per my comment on other answers this can be a very slow operation on the Mac. You should use raw disk mode. This was correctly done in the answer in the link the OP included, but did not want to use. – Milliways May 6 '16 at 3:30

Any disk utility that's not file system specific (raw backup) should do it. I think Disk Utility does it.

Take note I don't have a mac (not anymore)

And besides, how hard could it be to type dd if=/dev/sdd of=/home/user/desktop/sdcard.img on a terminal?

  • /dev/sdd is probably not your actual SD card device. Look for it. – pandalion98 Jan 6 '16 at 8:13

If you are using OS X with the dd command, use /dev/rdiskX instead of /dev/diskX and also bs=16m instead of bs=1m it should speed things up a lot.

  • Welcome to Raspberry Pi! Please take the tour and visit the helpcenter to see how things work here. Whilst this may theoretically answer the question, it would be preferable to include some explanation here, e.g. extend and explain the full command. Right now one has to read multiple answers and put things together. – Ghanima Sep 10 '17 at 12:19

Why not try? On my Mac Disk Utility doesn't even see the SD as a disk. It shows the FAT32 partition but not the others. You can create an image of this partition, but it doesn't even see ext4. Imaging partitions (while of use in some cases) will not let you copy a disk. Disk Utility refuses to deal with MBR disks.

diskutil at least shows the details of the partitions.

There are a number of command line tools which work, but dd is there and does work.

  • I was able to see all the partitions on the sd card, and make an image from my root partition (6 of the 8 GB on the card). I can't mount the .dmg on my Mac but I guess I'll try loading that image into a new card and see if it boots up on the pi. – pinhead Jan 6 '16 at 8:51
  • You correct my response and you thin your response it'svalid. Ok +Milliways. You not see other partitions, but Diskutils see ALL partitions and made a full clon usb card (MBR, and partitions) and grab on .dmg format. This file it's FULL restorable en other USB card. i66.tinypic.com/jt9ppf.jpg – abkrim Jan 6 '16 at 12:24

dd if=/dev/disk3 of=/home/user/desktop/images.img bs=1m

replace disk3 with what your mac tells you

after that you can copy this image to your sd card with Pi filler

  • How does the OP know what to use for disk3? as this is a potential destructive act, you should provide a more complete and thorough answer. – Steve Robillard Jan 6 '16 at 10:17
  • Good thing this got bumped up @SteveRobillard. Who knows what might have happened. – pandalion98 Jan 6 '16 at 10:45
  • Not only that, it is a slow operation on OS X (it can take many hours). There are faster options, but this was not the question. – Milliways Jan 6 '16 at 10:54
  • If there're "faster options" please, put here. Do not just complain of the responses of others. – abkrim Jan 6 '16 at 12:42
  • 1
    @abkrim Pointing out something is wrong is fine. Pointing out something is wrong and explaining the correct way is better, but if someone does not have time for that, it is better they simply say "this is wrong" than say nothing -- then it is up to you to decide about it, and you are of course free to ask for more information, but please do it politely. – goldilocks Jan 6 '16 at 13:52
  • Open terminal app
  • Run diskutil list this show all disk mounted (your card must be mounted) On example below it's /dev/disk2 with 32GB and 2 partition (one Windows_FAT_32 boot and other linux)

    diskutil list

    /dev/disk2 (external, physical):

    0: FDisk_partition_scheme *31.2 GB disk2

    1: Windows_FAT_32 boot 58.7 MB disk2s1

    2: Linux 31.1 GB disk2s2

  • umount (only partition not usb card) form Disk util or on Terminal.app with unmount /dev/disk2s1 (disk2s1 it's a my disk, and my boot partition mounted on desktop)

  • clone with dd for example:

    sudo dd if=/dev/disk2 of=~/Desktop/raspberrypi.dmg conv=sync,noerror bs=64k

NOTE: You must be careful with the example

This is an example.

The number and series of partitions shall reflect their devices and partitions.

  • If you are going to post comments (this is not an answer to the question) you could at least post good code. Your code can take many hours (if the user picks the right partition) or fill the users disk with rubbish. – Milliways Jan 6 '16 at 10:59
  • Well ... the same opinion it means to me your answer. I regret that my editor does not comply but try to format it in the answer. With my code, and with a little learning you can see the partitions, unmount the dispostivo without disconnecting, and make the backup. And all this in just 5 minutes. Have a good day. – abkrim Jan 6 '16 at 11:52

How about: https://medium.com/a-swift-misadventure/backing-up-your-raspberry-pi-sd-card-on-mac-the-simple-way-398a630f899c ? Found your question when checking something with etcher.io and my machine doesn't have enough free space for me to clone the sd i'm looking to at the moment but i've used this and verified it works to make an iso image that etcher will recognize but i haven't booted on pi again yet. Seems like a likely answer option though :) and i'd definitely agree this way would be easier for 80% of folks using pi with mac

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.