Monday, 15 May 2017

RPi, Raspberry image backup to Mac


This backup method will make a copy/image of the whole card even if there is very little data on it. So if the card is 16Gb, the backup file also will be 16Gb. On the other hand You can ZIP the image file to save space.

Connect the card reader, with the SD card inserted, to Your Mac.

Start the program Terminal, on Your Mac, and check Your SD cards name type.

$ diskutil list

and You will have something like

/dev/disk0 (internal, physical):                                              
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0     
   1:                        EFI EFI                     209.7 MB   disk0s1  
   2:          Apple_CoreStorage Macintosh HD            120.5 GB   disk0s2  
/dev/disk1 (internal, virtual):                                              
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            Macintosh HD           +120.1 GB   disk1    
                                 Logical Volume on disk0s2                  
                                 9519AF9B-4C53-41CE-BB98-1139A7C82D9D        
                                 Unencrypted                                
/dev/disk2 (external, physical):                                            
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *8.1 GB     disk2    



In this case "/dev/disk2" is the name of the card reader.

Make the backup with the following command using the Mac:s password. "pws_backup_2017-05-12.img" in the example is the name of backupfile to be created.

sudo dd bs=1m if=/dev/rdisk2 of=pws_backup_2017-05-12.img
Password:
15193+1 records in
15193+1 records out
15931539456 bytes transferred in 598.751589 secs (26607928 bytes/sec)

The example is made with a 16 Gb data card and the backup took 10 minutes.
Unmount the card

$ diskutil unmountDisk /dev/disk2             
Unmount of all volumes on disk2 was successful


and then remove the card reader

When You would like to restore the image to a SD card use the post here.

Note !! that You cant restore to a smaller SD card than the size of the image.

No comments:

Post a Comment