Just started playing around with a raspberry pi model b+ I've had sitting around for ages and I had a question? Is it possible to restore a Raspberry Pi from itself?

E.g: Can I put an image on the microSD card, and then reboot the Pi to install the new image wiping out everything previously installed and start afresh? Is it possible to do this without another computer to format and image the SD card? I currently have raspbian installed if that helps.

5 Answers 5


Not quite. You would overwrite the partition tables when you re-image it and replace said tables with the ones from the image. After your imaging program is done, it would release the file handle to the image file, but since the partition where the file is stored technically doesn't exist anymore, your program can't read it again. In theory, it would work but only once.

Also, the file needs to be at the end of the storage space so it doesn't get immediately overwritten.

Or at least that's how I think Linux deals with files. The last time I tried this (I did a few months ago), the Pi just hanged. Based on this experiment, you really need another computer to re-image the SD card.

An alternative would be to go the NOOBS method and store boot files on a separate partition then either booting to NOOBS or to an OS if installed. NOOBS somewhat already does what you said, but instead of re-imaging the entire SD, it only replaces the OS partitions. This link tells how NOOBS works.

  • 5
    Technically you could do by using (or perhaps even chrooting with) a RAM based root system (and either a very small custom image, or one from USB storage) but I think that is too far beyond the skill level of most users to be worthwhile. Using a system with a root FS on another device would be easier, but also not very worthwhile unless that's what you are doing to start with.
    – goldilocks
    Apr 22, 2016 at 14:55
  • @goldilocks Maybe I'll try that sometime. If it pays off, I'll open-source it.
    – Aloha
    Apr 23, 2016 at 1:31

With a big enough SD card, you could have 2 usable boot options - and manipulate the one not in use, which is fine, then update grub & reboot to the new OS.

You can't write to the currently mounted OS partitions without a spectacular crash, at least not wholesale like you're asking. Not least, Linux caches data so your new write will get bollixed when the cache flushes old data onto the new...


It can be done if you split the operation in stages. With the help of a RAM based distribution, such as for example my project Nard, one can free up the SD card for complex operations.

  1. Extract the contents of /boot from Nard (or other similiar distro)
  2. Erase everything in your current Raspbian SD card /boot
  3. Store Nard /boot/* into Raspbian SD card /boot
  4. reboot
  5. You should now be running from RAM and thus you can do anything you like with the SD card, such as downloading whatever image you need and wipe the entire SD with something new.

Sounds like you could use rpi-clone? I've been using rpi-clone every day for a few weeks to clone my running RPi3 running Raspian Jessie. It takes about 10 minutes to clone to a second Micro SD card. I then switch off, take out both cards, store the original and boot using the clone. Hence I know that the backup works. I rotate 3 cards in this way, so that I always have a safe card. It works for me ;-)


Sure you can. Just hold down the shift key when the white/grey screen appears. It even tells you that on the screen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.