forked from BaiGeorgi/backup-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup-xz
24 lines (24 loc) · 812 Bytes
/
backup-xz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
## Created by Georgi Patsev
## https://github.com/BaiGeorgi/backup-scripts
## Please read GPLv3! https://www.gnu.org/licenses/gpl-3.0.html
display_usage() {
echo "Run the script with two parameters /dev/[input] and output"
echo -e "Example:"
echo -e "./backup-xz /dev/sda backup"
echo -e "will create file backup.img.xz"
}
if [ $# -le 1 ] # if less than two arguments supplied, display usage
then
display_usage
exit 1
fi
if [[ ( $# == "--help") || $# == "-h" ]] # check whether user had supplied -h or --help . If yes display usage
then
display_usage
exit 0
fi
DISK="$1"
FILE="$2"
##dd if="$DISK" bs=4M | xz -q9e > "$FILE".img.xz ## Quiet mode.
dd if="$DISK" bs=4M | xz -vv9e > "$FILE".img.xz ## You can see the input and the output size, drink some cofee and return later.