1

I am pretty new to Linux.

I am configuring my RaspBerry that use RaspBian (that is a minimalistic Debian distribution).

Before changing some settings I want to have a backup of my entire system in the current state.

What can I do to save the entire system on a backup file (or something like it). I want create an immage of the SD card that contains my actual system (so it have to contains the 2 used partitions and the file system). I want to do this in such a way that if I do some error I can restore my system.

To write RaspBian on the SD card I used the Linux dd command, can I do the same operation in the opposite direction (copy the actual state of my SD card on a backup file)?

1 Answer 1

4

Yes, you can. Put your SD card in another machine and don't mount it, then do

dd if=/dev/sdX of=/path/to/some/file.img

(where sdX is your card device)

Just flip the parameters around if you want to restore.

3
  • Ok...now I have two doubts: 1) Why I have to do this operation on another machine? 2) Why have I to do it when the SD card is unmounted? Commented Jun 3, 2014 at 16:40
  • 4
    You should unmount it because you can't read a snapshot of the entire disk at one instant in time (it takes time to read the whole thing), so if the drive is mounted, changes may be written to the drive causing your image to be in an inconsistent state. If you unmount it then no writes will occur. That's also why you should do it on a different system, since it's hard to boot a Raspberry Pi with the card unmounted.
    – Icydog
    Commented Jun 3, 2014 at 16:42
  • 1
    In theory you could use a secondary card device, so everything in theory could be done, using the RaspPi. I am not sure what you would gain from doing this though.
    – Ramhound
    Commented Jun 3, 2014 at 17:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .