1#!/bin/sh 2# BAREOS® - Backup Archiving REcovery Open Sourced 3# 4# Copyright (C) 2016-2016 Bareos GmbH & Co. KG 5# 6# This program is Free Software; you can redistribute it and/or 7# modify it under the terms of version three of the GNU Affero General Public 8# License as published by the Free Software Foundation and included 9# in the file LICENSE. 10# 11# This program is distributed in the hope that it will be useful, but 12# WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14# Affero General Public License for more details. 15# 16# You should have received a copy of the GNU Affero General Public License 17# along with this program; if not, write to the Free Software 18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19# 02110-1301, USA. 20 21 22filename=${1:-sparse.dat} 23size=${2:-100M} 24 25echo "start" > $filename 26dd if=/dev/zero of=$filename bs=1 count=0 seek=$size 2>/dev/null 27echo "end" >> $filename 28 29size="`du --block-size=1 --apparent-size ${filename} | cut -f 1`" 30realsize="`du --block-size=1 ${filename} | cut -f 1`" 31 32printf "$filename created.\n" 33printf "size=%s\n" "$size" 34printf "realsize=%s\n" "$realsize" 35 36if [ "$realsize" -gt "$size" ]; then 37 printf "ERROR: realsize has to be smaller than size.\n" 38 exit 1 39fi 40