Saturday, August 21, 2021

How to backup and restore Raspberry Pi MicroSD card on Mac and Windows

 

In order to take a backup following are the basic steps:

  1. Connect the Micro SD card.
  2. Create an Micro SD card image which will act as a backup image.
In order to restore a backup following are the basic steps:
  1. Connect the Micro SD card.
  2. Format the Micro SD card.
  3. Write the Micro SD card image on the Micro SD card.


On Windows


To take backup

  • Connect your Micro SD card

    • Ensure that your computer have an SD card slot.
    • Insert Micro SD card in the SD card adapter which comes with the Micro SD card.
    • Insert the SD card adapter in the SD card slot.
    • Check if Windows is able to detect the card. SD card will have a boot as name.

  • Install Win32 Disk Imager (One of best softwares to use for this purpose but feel free to use other software. Though the steps for other software will be similar.)


  • Open Win32 Disk Imager




  • Select the location for the file where back is required to be created and the file name by either selecting the folder icon (blue icon) or by typing the path. Ensure that the file name should end with .img.


  • Select the SD card from Device dropdown.



  • Click on "Read" button and relax as this is going to take some time to create the backup file.


To restore a backup

  • Connect SD card 


  • Format the SD card

  • Open Win32 Disk Imager


  • Select the file from which the backup is required to be restored.


  • Select the SD card from Device dropdown


  • Select Write and relax. This will take more time as compared to the time it took for backup.




On Mac


To take a backup

  • Connect the SD card. Note: the SD card will not be detected as a card to read the contents and you may see an error popup. Ignore the error popup.

  • Open the Terminal and run this command
$ diskutil list

This command will display all the connected storage devices

 


  • Identify the Name, Size and Volume of your SD card by looking at the output


  • Type this command to create a backup file for the SD card (ensure the file extension is .dmg)
$ sudo dd if=<Volume> of=<Location>/<filename>.dmg 
e.g. sudo dd if=/dev/disk1 of=~/Desktop/pi-backup.dmg


To restore a backup

  • Connect the SD card (Ensure that the card is a blank card or is pre-formatted)


  • List the disk volumes using the following command (refer output above)

$ diskutil list


  • Run the following command to restore the backup

$ sudo dd if=<Location of file>/<filename>.dmg of=<Volume>

e.g. sudo dd if=~/Desktop/pi-backup.dmg of=/dev/disk1


No comments:

Post a Comment

How to install node using Brew

This article talks about some simple steps to follow to install node using Brew . Though there are many other ways to do it but the method ...