dotfiles/tools/backup_sdcard
2015-02-14 08:33:03 +01:00

23 lines
347 B
Bash
Executable file

#!/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?
sudo umount $device
sudo sync
sudo pv -tpreb $device | dd bs=4M | pixz > $dest_file
sudo sync