diff options
author | irina <irinagomez@us.es> | 2013-05-21 11:55:01 +0000 |
---|---|---|
committer | irina <irinagomez@us.es> | 2013-05-21 11:55:01 +0000 |
commit | cd1f0487198003f9895015cb8254bb848d5d2016 (patch) | |
tree | efe84cfcef2f2abdbe73938b431e948e96946633 /client/shared/scripts/createDiffImage | |
parent | b2651a63576eec414f755325b90b340a9515aeff (diff) |
#565 optimiza tamaño de las imágenes
git-svn-id: https://opengnsys.es/svn/branches/version1.0@3808 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/shared/scripts/createDiffImage')
-rwxr-xr-x | client/shared/scripts/createDiffImage | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/client/shared/scripts/createDiffImage b/client/shared/scripts/createDiffImage index 721f747d..c0ccb846 100755 --- a/client/shared/scripts/createDiffImage +++ b/client/shared/scripts/createDiffImage @@ -39,9 +39,15 @@ function onexit() { fi exit $exit_status } + +# Establecemos factor de compresion +COMPRESS=90/100 +COMPRESSLINUX=70/100 + #Carga el configurador del engine desde el fichero engine.cfg [ -z $OGENGINECONFIGURATE ] && source /opt/opengnsys/etc/engine.cfg -# opciones de rsync + +# Factor de calculo de Time out al crear imagen: valor por defecto en engine.cfg CREATESPEED=${CREATESPEED:-"100000*4"} TIME1=$SECONDS @@ -108,6 +114,19 @@ ogCheckFs $1 $2 >$OGLOGCOMMAND || ogRaiseError $OG_ERR_PARTITION "ogCheckFs $1 $ TIMEAUX1=$[SECONDS-TIME1] echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX1/60]m $[TIMEAUX1%60]s" | tee -a $OGLOGSESSION $OGLOGFILE +# Borramos ficheros de paginacion y configuracion +case "$(ogGetFsType $1 $2)" in + EXT[234]) + ogCleanLinuxDevices $1 $2 + rm -rf $ORIG/tmp/* + COMPRESS=$COMPRESSLINUX + ;; + NTFS) + ogDeleteFile $1 $2 pagefile.sys + ogDeleteFile $1 $2 hiberfil.sys + ;; +esac + # Crear la imagen. echo " " > $OGLOGCOMMAND TIME2=$SECONDS @@ -135,8 +154,8 @@ ogLock $1 $2 echo -n " $MSG_SCRIPTS_CREATE_SIZE" | tee -a $OGLOGSESSION $OGLOGFILE cd $ORIG SIZEDATA=$(cat /tmp/ogimg.info | tr '\n' '\0'| du -c --files0-from=- 2>/dev/null|tail -n1 |cut -f1) -let SIZEREQUIRED=SIZEDATA*115/100 -# El tamaño mínimo del sistema de ficheros btrfs es 250M, ponemos 300 +let SIZEREQUIRED=$SIZEDATA*$COMPRESS +# Tamaño minimo fichero imagen 300000 [ $SIZEREQUIRED -lt 300000 ] && SIZEREQUIRED=300000 TIMEAUX4=$[SECONDS-TIMEAUX3] @@ -146,7 +165,7 @@ TIMEAUX4=$[SECONDS-TIMEAUX3] echo " $SIZEREQUIRED $SIZEFREE" | tee -a $OGLOGSESSION $OGLOGFILE [ $SIZEREQUIRED -gt $SIZEFREE ] && ogRaiseError $OG_ERR_CACHESIZE "$3" -echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL $SIZEREQUIRED: $[TIMEAUX4/60]m $[TIMEAUX4%60]s" | tee -a $OGLOGSESSION $OGLOGFILE +echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX4/60]m $[TIMEAUX4%60]s" | tee -a $OGLOGSESSION $OGLOGFILE # Configuro la informacion del tamaño de los datos en /tmp/ogimg.info sed -i s/SIZEDATA/"$SIZEDATA"/g /tmp/ogimg.info @@ -164,7 +183,9 @@ echo "[80] $MSG_HELP_ogSyncCreate" | tee -a $OGLOGSESSION $OGLOGFILE # Copio los datos a la imagen diferecial : ogSyncCreate $1 $2 $3 "$5" $DIFFEXT -ogUnmountImage $3 "$5" $DIFFEXT +# Reducimos la imagen diferencial +echo "[90] $MSG_HELP_ogReduceImage: $3 /$4.$IMGEXT" | tee -a $OGLOGSESSION $OGLOGFILE +ogReduceImage $3 "$5" $DIFFEXT ogUnmountImage $3 "$4" $IMGEXT @@ -184,8 +205,6 @@ file "$DIFFFILE" |grep "BTRFS Filesystem" >/dev/null || ogRaiseError $OG_ERR_IM #resumen de la operacion IMGSIZE=$(ls -s ${DIFFFILE[CACHE]}| cut -f1 -d" ") -#IMGOS=$(ogGetImageInfo `ogGetPath $3 $4.img`) NO FUNCIONA Hay que modificar la funcion para las imagenes squash - TIME=$[SECONDS-TIME1] echo "[100] $MSG_SCRIPTS_TIME_TOTAL $[TIME/60]m $[TIME%60]s" | tee -a $OGLOGSESSION $OGLOGFILE echo " FileSystem $PART with $SIZEDATA KB data created onto file-image as $4 and used $IMGSIZE KB acros DFS rsync " | tee -a $OGLOGSESSION $OGLOGFILE |