From 503a2239c33a205c466610ba780e0cfd2d127d8c Mon Sep 17 00:00:00 2001 From: Cyryl Plotnicki-Chudyk Date: Sat, 11 Oct 2014 11:25:24 +0200 Subject: [PATCH] sdcard backup tool added --- install_ubuntu.sh | 2 +- tools/backup_sdcard.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 tools/backup_sdcard.sh diff --git a/install_ubuntu.sh b/install_ubuntu.sh index fd140d24..e3431076 100755 --- a/install_ubuntu.sh +++ b/install_ubuntu.sh @@ -1,7 +1,7 @@ #!/bin/bash sudo apt-get update sudo apt-get dist-ugprade -sudo apt-get install meld whois zsh tmux vim atop aria2 curl +sudo apt-get install meld whois zsh tmux vim atop aria2 curl pv pixz DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" $DIR/install_common.sh diff --git a/tools/backup_sdcard.sh b/tools/backup_sdcard.sh new file mode 100755 index 00000000..25f5a7b8 --- /dev/null +++ b/tools/backup_sdcard.sh @@ -0,0 +1,21 @@ +#!/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 + +umount $device? +umount $device + +sudo pv -tpreb $device | dd bs=4M | pixz > $dest_file +