12.3 C
Texas
Melhttp://www.osradar.com
Guru Unix /Linux and GNU supporter

Backup/Restore Your Raspberry Pi System

Raspberry Pi is one of the best SBCs (Single Board Computer) in the world. I personally love the Pi system for having such a power within just a small space. If you own one, you already know what I mean. This computer can do tons of complex works, just like a normal computer.

If you own a Pi, you know how to use it properly, right? You need to write an SD card with the essential operating system for the Pi to operate its mechanisms. There are tons of operating systems available that are optimized for Pi systems, including major Linux distros and even Windows 10! The main disadvantage here is using the SD card, which is quite susceptible to physical and memory damage. Once corrupted, you may lose your entire Pi project and you have to start from the beginning.

How to make a backup

SD cards aren’t as good as other storage types as they’re more vulnerable to internal memory damages, physical damages etc. You can easily backup the entire SD card data within an image file so that in case of emergency, your data can be restored. Moreover, you can even distribute your copy of installation to others.

  • Windows

If you’re on Windows, it’s too easy to do. In this scenario, we have to use a tool named Win32 Disk Imager. Download and install the tool.

- Advertisement -

Now, connect your SD card to your PC and follow the following steps. For demonstration purpose, I’m using a USB flash drive. But don’t worry; the steps are identical to SD cards.

  • Open Win32 Disk Imager.
  • Select your SD card.
  • Select the path to save the image file. Don’t forget to give a name.

  • Click “Read”.

Now, wait patiently. Your entire SD card will be backed up in the image.

  • Linux

In Linux, you can use “dd” command to create an easy backup of your SD card.

  • Connect your SD card to your PC.
  • First, we have to identify the label of SD card. Run this command:
sudo fdisk -l

In this case, it’s “/dev/sdb”.

  • Run this command:
sudo dd bs=4M if=/dev/sdb | gzip > ~/Desktop/image`date +%d%m%y`.gz

You can change the path, but I’m saving it on “Desktop”.

Your Raspberry Pi SD card is now safely stored in an image file.

How to restore the image

  • Windows

Using the Win32 Disk Imager, you can easily restore or re-write the image file to an SD card.

  • Open Win32 Disk Imager
  • Browse for the previously created image file.
  • Select your SD card.
  • Click “Write”.

Done! Your Pi system is restored!

  • Linux

Run the following code to write your backup image on the SD card.

sudo gzip -dc ~/Desktop/image240318.gz | sudo dd bs=4M of=/dev/sdb

It’s now complete!

Recently, Pi Project launched their latest model – Raspberry Pi 3 Model B+. Check out all the new features!

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article