[ALUG] RPi SD backup/restore

Mark Rogers mark at more-solutions.co.uk
Wed Sep 13 10:42:38 BST 2017


I've been experimenting with backing up and restoring Raspberry Pi SD cards.

There is of-course a very easy way: use "dd" or similar to create a
disk image. However it has three disdvantages; it is slow, and it
creates very large backups. And it's hard to extract individual files
from the backups.

I've written up a quick process [1] for doing it manually, which is essentially:
1. Backup (or restore) the partitions using sfdisk
2. (Restore only) Create the filesystems on the destination
3. Backup (or restore) the files using tar.

However I'd like some advice on scripting and improving it.

In particular, this process creates three files (one for the partition
info, and one each for the files from the two partitions). I'd like to
end up with a single file, which I can do by just tar'ing the three at
the end, but given the size of the files I want to keep the use of
temporary files to a minimum.

Also, at the moment it's quite inflexible in terms of restoring to a
different sized card, but ought not be.

But regardless, I figured there'd be enough Pi users around here who
might find it useful.

(Use at your own risk, it's had very limited testing so far.)

[1] https://docs.google.com/document/d/e/2PACX-1vRk_zldu0Ra6MEEepTSKCzD55ANeasQOY9iJFY3Kh9-N_rz7Wdww1NA5CnM0s62i0f1OEyIDD4iFzZz/pub

-- 
Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450
Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER



More information about the main mailing list