1#!/bin/bash
2
3set -e
4
5if [ "$#" -ne 2 ]; then
6    echo "$0 src.img target.img" >&2
7    exit 1
8fi
9
10srcimg=$1
11target=$2
12
13disksize=$(stat -c %s $srcimg)
14
15mycount=`expr $disksize \/ 1024 - 2048`
16
17dd if=$srcimg of=$target ibs=1k skip=1024 count=${mycount}
18
19