Best way to backup SD card


A2000

Member
Joined
Apr 16, 2012
Messages
289
Hi,


what is the best way to backup my SD cards? The cards contain several partitions, some ext4 and some FAT32. Both cards are 128GB in size. The second card is partly neglect-able as the data on it is mostly data already backed up somewhere else (music...). It's the Pandora specific part which bothers me.


I can read the cards with my desktop computers with Windows, MacOS or Linux. But as the biggest partitions are ext4 I think Linux will be best.


For easy recovery it might be desirable to backup a whole card, but does this mean 128GB per backup (=cloning)?


What is your approach?


A2000
 
Yeah, dd is the easiest way to backup multiple partitions at once, but it's limited in that it will only put those partitions back as is, to a card of the same size or bigger (leaving a gap at the end in the latter case).  It's also harder to pull individual files out of the backup having made it at a later date; you'd need to crop the output to each partition manually, then mount the partitions.

The Pandora also includes rsync and scp; useful command line tools for synchronising or copying files over the network.  However, if you wanted to eject the card and plug it into a reader attached to a computer, it would almost certainly be faster and more reliable, and you'd be better off using something like 'cp -a' from the command line to copy the data across as individual files on the target file system; or you could still use rsync if you wanted it to skip files it already had.

Eki's recommendation might be easier to use though; I've never tried it personally.  But it seems like it's focussed on network connected media, and not as much use if you've plugged the card in locally.
 
I do not recommend dd for backing up SD cards. As the card wears its effective size shrinks slightly so if you try to restore such a backup after a year or two you may find it impossible, even to the exact same card.

For my backups I just "sudo tar czpf": add some "--exclude"s (/dev, /media, /mnt, /run, /proc, /sys, I think that's it) and you can backup an entire live disk and restore it to anything formatted with enough space later.
 
whatever you do, don't make the assumption that if the filesystem is ok and there are no error messages the data on an SD is also ok, and use it to .e.g. generate a master copy. I have had an SD card with a ~30GB music library silently fail and taint 100s of music files without any indication was wrong. Only when playback failed I noticed and comparing md5sums I noticed the files had changed..luckily I had another copy :) I guess this can happen on any storage medium but SD cards seem to have less safeguards agains corruption
..
 
Most backup programs will care about identify if they're doing delta backups, but unfortunately they tend to do it so that they can back up your changed file, not notify you that it's changed when you didn't expect it to.

You really need a separate tool to do that, because the set of files you want to back up and the set of files you don't expect to change are significantly different sets in most cases, I'd have thought.
 
Thank you all for your suggestions. If I read correctly most you do backups on file level which is fine for incremental copies. While backing up partitions with dd is way faster it needs a lot more space on the backup volume and does not support incremental backups.


What about filesystem differences? Does Syncthing support file attributes or do I end with unaccessible files due to different ownership?
 
Win32 disk imager might work. I have used it to write and backup images for my raspberry pi and covers all formats. Plus it copies a whole sd card at once.
 
Last edited by a moderator:
Back
Top