From: Silvio Rhatto Date: Sat, 3 Jun 2017 17:02:54 +0000 (-0300) Subject: Copy guest images as sparse files X-Git-Tag: 0.1.0~425 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=14be54ae3b7f33a684d969bac74fe7aaf4c15100;p=kvmx.git Copy guest images as sparse files --- diff --git a/kvmx b/kvmx index 29e5661..16da59d 100755 --- a/kvmx +++ b/kvmx @@ -274,9 +274,10 @@ function kvmx_up { echo "Copying base image $baseimage to $image..." if which rsync &> /dev/null; then - rsync -ah --progress $baseimage $image + rsync -ah --sparse --progress $baseimage $image else - cp $baseimage $image + # See https://rwmj.wordpress.com/2010/10/19/tip-making-a-disk-image-sparse/ + cp --sparse=always $baseimage $image fi if [ -e "$basekey" ]; then @@ -735,9 +736,9 @@ function kvmx_clone { # Copy image and configuration echo "Copying basebox..." if which rsync &> /dev/null; then - rsync -ah --progress `dirname $image`/ $FOLDER/ + rsync -ah --sparse --progress `dirname $image`/ $FOLDER/ else - cp -r `dirname $image` $FOLDER/ + cp -r --sparse=always `dirname $image` $FOLDER/ fi # Remove old state folder