[How to] Make periodic backups of whole OSMC system

In my case, and due to the small size of the Pi system, I opted for a simple gzip dd image, made in off-line (shutdown osmc, place the sd card in the PC, do the backup).
Have already restore it for several times and work just as the perfect system snapshot.

I suggest to run something like the following command in a PC linux:

  • Backup:
    dd if=/dev/sdb bs=512 | gzip -c > backup.img.gz
  • Restore:
    gzip -d -c backup.img.gz | dd of=/dev/sdb bs=512

(assuming the sdcard is /dev/sdb in the pc)
This also works in windows using cygwin (just need gip.ex, dd.exe, and cygwin dll’s).

I’ve choose to use a 16GB micro sdhc, and partitioned it with the 2 needed osmc partitions (1 with fat for boot, and 1 with ext4).
Limited the size of the 2nd partition to stop around the 4GB boundary, and so making smaller images with (previously validated the correct partition ending sector+1 with fdisk):

dd if=/dev/sdb bs=512 count=8302592 | gzip -c > backup.img.gz

With this aproach I have compressed images with around 1.6 GB - 10 mins to backup, 20 mins to restore (depending on the sdcard and the reader).