Just wondering what would be the best method to fully backup or clone my sd card incase the card fails
I am already backing up my snapshots etc but would like to also do a full sd card image backup
Thanks for any help
Just wondering what would be the best method to fully backup or clone my sd card incase the card fails
I am already backing up my snapshots etc but would like to also do a full sd card image backup
Thanks for any help
I using RPi-Clone - works great.
I assume you’re using a Pi because you want to back up an SD-Card.
Is your main computer a Mac, Windows or Linux system?
If it’s a Mac or Linux system I’ve got a nice script I wrote that will make a compressed image of a drive.
If you want simple and don’t mind an uncompressed file, you can simply use the following command in the terminal.
Mac: sudo dd if=/dev/rdiskX of=~/Desktop/sd-backup.img bs=1m
Linux: sudo dd if=/dev/sdX of=~/sd-backup.img bs=1M
Replace X with the number or letter of the device. You can find this with Disk Utility on macOS or du -f
on Linux.
Thanks @timothybrown, I am running a Mac, and that script is just what I needed thanks for sharing much appreciated
You’re welcome!
I’ll put my little script that does compressed images on GitHub tonight and post a link. It’s a lot friendlier to use as you get a progress indicator as it dumps the SD card (the command I posted above doesn’t; you won’t see any indication it’s doing anything until it finishes).
Compressing the image on the fly also saves a lot of space. If you’ve got a 16GB SD card, a raw image will be 16GB even if you’ve only got 4GB of data on it. With compression you’ll end up with a 3GB or so zip file that contains the 16GB .img file.
Thanks, but way too many commands for my very inexperienced brain matter just needed something simple so I could swap cards around whilst testing stuff however, I do appreciate the advice/help
If you don’t need progress indication or anything and you’re fine with just a zip file output, you can just add on to the command I posted earlier:
sudo bash -c "dd if=/dev/diskX bs=1m | zip -q > ~/Desktop/image.img.zip"
That’s as simple as you can get.
If you want a progress indicator and a pretty text interface, I’ve uploaded my script here: https://github.com/timothybrown/rpi-backup
It does require you to install Homebrew (because it needs PV to give you a pretty progress indicator), but that only takes a single command.
Just giving you a few options.
No worries, wouldn’t work on a Mac anyway.
But for an RPi it’s a great and straightforward solution.
And, believe me: if you can get it to me work, most everybody else can as well.
Hi all.
I would like to ask in relation to this script if or when after I have made my backup can I simply write the image back to a new card and basically plug the new card in and awy we go? I have had one card fail so not too bad really in about 18 months but for me I would be happy replacing a card each 6 months before it dies.
Second to that, I have my system using Node-Red to do all my automations etc and at 3 am each day it fires a full snapshot and at 4am its uploaded to my Dropbox with the last 4 remaining on the card.
So having said that if I had a failure would it be just as easy to grab a new card, install the new Hassio and then do a restore from one of those snapshots?
The reason I do the daily part is I love to tinker and can quickly screw up a working system so I figure I am at worst a day behind
Peter
Yes