Tuesday, April 12, 2016

Backup and Restore Your Raspberry Pi SD Card Using Mac OS X

For the credit and full-complete writing about this post, you can check it here and here, I only made some modification to make it even simple.

This was done by me when I tried to expand SD capacity from 8 to 16 GB. It's very simple and practical. After this backup-restore process done, you need to expand the file system so you can acquire full 16 GB on new SD card. So, let's begin..

Backup
1. Turn off RPi
2. Put SD card into card reader slot
3. Open up 'Terminal' app (from Application -> Utilities -> Terminal)
4. Type:
$ sudo bash
5. Type in your password
6. Type these in sequence:
# mkdir -p ~/rpi/backups
# cd ~/rpi/backups
 7. Check where your SD card is listed (e.g.: mine is listed as /dev/disk2s1)
# df -h
8. Eject your SD card:
# diskutil unmountDisk /dev/disk2s1
9. Backup your SD card to image file: (please note that you have to add 'r' before 'disk')
# dd if=/dev/rdisk2 of=~/rpi/backups/backup-today-rpi.img bs=1M
10. When complete: (again, add 'r' before 'disk')
# diskutil eject /dev/rdisk2 

Restore
1.  Put new SD card into card reader slot
2.  Check where your SD card is listed (e.g.: mine is listed as /dev/disk2s1)
# df -h
 3. Eject your SD card:
# diskutil unmountDisk /dev/disk2s1
4. Restore your image to new SD card:
# dd bs=1M if=~/rpi/backups/backup-today-rpi.img of=/dev/rdisk2
5. When complete:
# diskutil eject /dev/rdisk2

Expand Filesystem
1. Powering up your Raspberry Pi
2. Execute this command:
$ sudo raspi-config
3. Choose 'Expand Filesystem"
4. Reboot

And you're done! :)

No comments:

Post a Comment

Hi, for all of those who already put comments on my blog post, thanks.. really appreciate it. And for those who have not, just put your comments here :)