You don't say if the card is NOOBS. This has a "Recovery" partition, which OS X won't mount (as it conflicts with the OS X Recovery partition. (I wish NOOBS has chosen a different name.)
There are a few other problems with your backup.
You need to make sure the card is unmounted, also unless you use rdisk it will be glacially slow, and you should specify a block size.
My OS X script, below, finds the correct dev
and includes the above.
PS I suggest you DON'T use .dmg
for the extension.
EDIT 2017-02-10 Updated to latest script
#!/bin/bash
# script to backup Pi SD card
# 2017-02-10
# DSK='disk4' # manual set disk
OUTDIR=~/temp/Pi
# Find disk with Linux partition (works for Raspbian)
# Modified for PINN/NOOBS
export DSK=`diskutil list | grep "Linux" | sed 's/.*\(disk[0-9]\).*/\1/' | uniq`
if [ $DSK ]; then
echo $DSK
echo $OUTDIR
else
echo "Disk not found"
exit
fi
diskutil unmountDisk /dev/$DSK
echo please wait - This takes some time
echo Ctl+T to show progress!
time sudo dd if=/dev/r$DSK bs=4m | gzip -9 > $OUTDIR/Piback.img.gz
#rename to current date
echo compressing completed - now renaming
mv -n $OUTDIR/Piback.img.gz $OUTDIR/Piback`date +%Y%m%d`.img.gz
The following is my restore script (you need to set dev
)
NOTE These days I just use Etcher
which is easier (and safer)
#!/bin/bash
# script to restore backup to Pi SD card
# 2018-06-21
DSK='disk3'
# Image name (no ext)
IMG='Piback20180925'
# Check for sensible disk
export PTYPE=$(diskutil list /dev/$DSK | awk '/GUID_partition_scheme/ {print $2}; /Apple/ {print $2}; /Windows_NTFS/ {print $2}' )
if [ "$PTYPE" ]; then
echo "Disk not a SD Card - Contains "$PTYPE
exit
elif [ ! /dev/$DSK ]; then
echo "/dev/$DSK not found"
exit
fi
echo Ensure SD partitions are unmounted!
diskutil unmountDisk /dev/$DSK
# Check if image exists - else try to uncompress
if [ -s $IMG.img ]; then
echo $IMG.img exists
elif [ -s $IMG.img.gz ]; then
echo Copying $IMG.img.gz
echo Ctl+T to show progress!
#time gunzip -k $IMG.img.gz
time gunzip -kc $IMG.img.gz | sudo dd conv=sync of=/dev/r$DSK bs=4m
exit
elif [ -s $IMG.zip ]; then
echo Copying $IMG.zip
echo Ctl+T to show progress!
time unzip -p $IMG.zip | sudo dd conv=sync of=/dev/r$DSK bs=4m
exit
fi
echo please wait - This takes some time
echo Ctl+T to show progress!
time sudo dd conv=sync if=$IMG.img of=/dev/r$DSK bs=4m
exit
I have modified my script to support NOOBS (which has multiple Linux partitions) by changing the line which detects the dev
.
export DSK=`diskutil list | awk '/Linux/ {print $5}' | cut -c 1-5 | uniq`
fdisk
(OSX should have that)? See last few paragraphs here.