What’s the best way to backup the SD card each week?
Clone the entire card to another of the same size. Use dd or ddrescue for that, but any Linux cloning tool can work. I use something like fsarchiver because it backs up with compression and I don’t have to waste an SD just for a backup. Any tool that does bit-4-bit copies will work, they just waste extra storage. This sort of backup needs to be done off-line - basically remove the SD and connect plug it in elsewhere. Backup at the device level - either whole device or partition. DO NOT MOUNT the storage.
If you don’t need to backup anything except the kodi stuff, you can use any normal linux backup tool like rdiff-backup or rsync or rsnapshot or rbackup and do the backups over a network. I’ve never tried to use a GUI for backups - GUIs and root don’t mix and to get a good backup, the process needs to run as root.
Don’t use FTP. FTP should have died in the mid-1990s. Use something that is secure and respects your credential security. Can’t believe we still have to say that 20 yrs later. Stop using plain FTP. Use sftp instead.
My OSMC has these 2 partitions:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p2 29G 21G 7.4G 74% /
/dev/mmcblk0p1 240M 21M 219M 9% /boot
That means I need to backup 2 partitions. I don’t keep media on the r-pi, just cached data and metadata. So, on a different machine, I’d run something like these 3 cmds:
sudo sfdisk -d /dev/mmcblk0 /Backups/osmc/log.partitions
sudo ddrescue /dev/sdZ1 /Backups/osmc/osmc-boot-204M.img /tmp/log.osmc.boot
sudo ddrescue /dev/sdZ2 /Backups/osmc/osmc-data-29G.img /tmp/log.osmc.boot
sdZ would be the device as seen on a Linux machine. To recreate the partitions for restore on a new disk, there’s an sfdisk import thing - I’d have to look it up. Then I’d reverse the
ddrescue {source} {target} logfile
from what was done above.
Clear as mudd? This wouldn’t put the boot sector back - do r-pi’s have that?
Just do a
sudo ddrescue /dev/sdZ /Backups/osmc/osmc-total.img /tmp/log.osmc-total
and everything on the SD will be copied - boot, partitions, data, programs, OS, everything.