0

I seem to be able to find lots of guides for backing up my PI that involve taking the SD card out, or running dd and hoping nothing changes.

But is there any way to take a proper, system-level, backup of my PI onto a NAS? I know with LVM you can use snapshots, but Raspian doesn't use LVM. Is there another way?

To be clear - I want to backup the entire SD card, so if it fails, I can grab a new one and restore. Or if I install too much crap and break the OS I can roll back.

xorsyst
  • 101
  • 2
  • Please, whatever you do, do not use `dd` for backups! There is some very bad advice around about that. – goldilocks Mar 06 '15 at 14:17
  • @goldilocks http://raspberrypi.stackexchange.com/questions/311/how-do-i-backup-my-raspberry-pi is heavily infested with `dd`... And I believe there is a newer thread (possible dupe if this one) which I just cannot find right now. – Ghanima Mar 06 '15 at 14:20
  • @Ghanima Yeah, I would feel heavy handed closing that one by moderator fiat as it has a ton of votes -- but if you want to vote that that way, feel free ;) It's not impossible to use `dd`, it's just silly. – goldilocks Mar 06 '15 at 14:26
  • That "duplicate" does not have an accepted answer! So how should I do this? – xorsyst Mar 06 '15 at 14:35
  • Choose the method you like best. There's more than one way to do this. The two top answers there suggest `rsync` or `tar`, which are pretty canonical on linux (since this is really a general linux question, you might look around [Unix & Linux](http://unix.stackexchange.com/) as well). The difference between the two is in the nature of the backup; with `rsync` you are creating a mirror (identical copy), with `tar` you are creating an archive (compressed file which can be extracted later). – goldilocks Mar 06 '15 at 14:47
  • @goldilocks `dd` has its uses (I am well aware of its limitations), but the `rsync` solution you keep referencing also has shortcomings (I have comment on this before, and posted an answer which addresses some of these). Both have their places. I believe what the OP wants is an image backup. I know of no solution which does this - it should backup partitions, compress and allow restoration to different sized disks - like the many backup utilities on Windows. – Milliways Mar 07 '15 at 00:00
  • @xorsyst I would have posted as an answer with code, but it is closed. You can use `dd`, but this is dangerous on a running system. It also will NOT restore to a different card, if it is not identical in size (or larger) - even nominally identical cards may differ. If you have a NAS (it really needs to be ext4 which will will keep permissions) you can use `rsync`. You should restore to a SD with a new blank image. – Milliways Mar 07 '15 at 00:10
  • @Milliways `dd` does have its uses, but it's a raw block level tool, which is why it isn't appropriate for backing up the content of a filesystem. If I have a .pdf on a DVD, the sane way to backup that file is to copy it out, not to duplicate 4 GB of mostly garbage because I think the .pdf is synonymous with the DVD. It will work, but it's silly, aka. bad advice; it rhymes with "superstitious" and "spirits made my hard drive". If someone is hell bent to copy 100% of the raw blocks on a device because doing a restore from content is too mind boggling, fine – goldilocks Mar 07 '15 at 03:45
  • -- but then there is no "best practice" question here, just `dd` the whole thing "and hope nothing changes". That is NOT something that should be recommended as a normative means of backing up a root filesystem. Questions of the sort "I don't want to do this the rational way, please help" are just that. – goldilocks Mar 07 '15 at 03:46
  • BTW, @Milliways, you can still post an answer on the dupe. The point of questions closed as duplicates is to serve as signposts that all lead back to the same place. I'm not banning your idea! – goldilocks Mar 07 '15 at 03:49

0 Answers0