Backing up and restoring whole block devices
SD cards are not really a reliable storage, especially when used constantly e.g. while sitting in always powered-on Raspberry Pi. Because of that I’ve recently needed to perform lots of backup/restore operations ;) I wrote this script for backing up:
#!/bin/bash if [[ -z $1 ]]; then echo "usage: $0 device_to_clone" exit fi device=$1 timestamp=`date +%Y%m%d` dest_file="/tmp/$timestamp.dd.xz" echo "about to clone $device to $dest_file" echo "ctrl-c or [enter]" read sudo umount $device?
[Read More]