*Disclaimer: I can follow directions for Terminal, but I am not a nix user by default.
I have a Raspberry Pi that I just had to restore. Before I get anything else installed I would like to create a clone image that I can restore if required.
I have done this by inserting the SD card in my Mac and using the following:
sudo dd if=/dev/rdiskx of=/path/to/image bs=1m
If I SSH from my Mac, can I create a clone across the network to my machine? There is not enough room on the SD card to do it locally.
dd
as a backup tool, that's up to them, but at the same time -- just like a question with posted code containing an obvious programming faux pas -- it should be indicated that this is the canonically wrong method and provide a more normative, orthodox alternative. Hopefully this at least helps to prevent other people being led astray: "Oh, here's a question about how to back up my pi" -- no, this is a question about how not to back up the pi. – goldilocks Feb 21 '14 at 06:28rsync
on the Mac side if you are doing it from there -- I'm not a big OSX user, but it appears to be standard equipment, fortunately. It maybe a slightly older version than is used on raspbian/linux/the pi but the man page matches up. – goldilocks Feb 21 '14 at 14:26Debating on posting another topic about this. Can I do a clone that will JUST do the contents? I built my system on a 16GB card so my image is 16GB, but would like to restore to a 4GB or 8GB card...
Worth a new topic?
– Kray Mar 03 '14 at 20:18So the rsync will allow for this over the DD as well?
– Kray Mar 03 '14 at 20:46rsync
clones a directory tree; it's copying files, whereasdd
copies raw data blocks from the device. It isn't aware of any files or filesystem beyond the one containing the device node (/dev/foo
). If you've ever copied cassette tapes, same idea. Whether there are actually any songs on the tape, etc., it's the same process. You just copy 30 min of tape. Likewise,dd
just copies X amount of data, much of which could be empty junk. It is a useful tool, just not so much for the purpose of backing up a filesystem. – goldilocks Mar 03 '14 at 20:52