Is it possible to fully copy an SD card (including the MBR)?

349 views Asked by At

I have an SD card that I use in my Raspberry pi configuration, and I recently purchased a bigger card.

I'd like to avoid to re-install the os (OpenElec) and to transfert all the files already present (almost 60Gb), but to do something like dd from the sdcard to my local disk, then do an other dd from my local disk to the new sdcard and that's it.

Is it possible?

Plot twist, I'm on MacOS (but I believe that for that kind of work, it's quite similar to Linux, I'm not afraid of command line).

Thank you for your help.

1

There are 1 answers

3
Mark Setchell On BEST ANSWER

To find the drives, their partitions and device special file names on a Mac, you would run this in the Terminal:

diskutil list

Sample Output

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *3.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Macintosh HD            3.0 TB     disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:          Apple_CoreStorage Macintosh HD            121.0 GB   disk1s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk1s3
/dev/disk2 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           +3.1 TB     disk2
                                 Logical Volume on disk1s2, disk0s2
                                 EF247607-3049-4EF0-8DFB-35B7ED84B7C0
                                 Unencrypted Fusion Drive
/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *12.0 TB    disk4
   1:                        EFI EFI                     209.7 MB   disk4s1
   2:                  Apple_HFS SystemClone             3.0 TB     disk4s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk4s3
   4:                  Apple_HFS OldMachine              550.0 GB   disk4s4
   5:                  Apple_HFS Spare                   1000.0 GB  disk4s5
   6:          Apple_CoreStorage TimeMachine             7.4 TB     disk4s6
   7:                 Apple_Boot Boot OS X               134.2 MB   disk4s7
   8:                  Apple_HFS Untitled                251.5 MB   disk4s8
/dev/disk5 (external, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS TimeMachine            +7.4 TB     disk5
                                 Logical Volume TimeMachine on disk4s6
                                 C7E53345-5059-45D8-826C-B10B6F16AD20
                                 Locked Encrypted

Then very carefully select which ones have the right size and filesystem to match your SD card for input from and output to. Then use the entire disk name (rather than any slices which end in sN like /dev/disk5s2 ) to get the MBR:

sudo dd if=/dev/disk5000 of=/dev/disk5001 bs=65536

The <disk5000> above is a placeholder for the real name as I do not want to trash anyone's disk who is daft enough to copy/paste my example without checking it matches their system.