#871: Dejar espacio libre entre particiones lógicas y alinear partición de caché en sector físico para discos con sectores de 4 KB.

remotes/github/pjlink
Ramón M. Gómez 2018-09-25 18:07:49 +02:00
parent 83d87a3903
commit 8076226512
2 changed files with 7 additions and 2 deletions

View File

@ -87,7 +87,7 @@ SIZE=$[$SIZECACHE*2] # Tamaño en sectores de 512 B.
IOSIZE=$(fdisk -l $DISK | awk '/I\/O/ {print $4}')
if [ $IOSIZE -eq 4096 ]; then
END=$[$END-8192]
START=$[END-SIZE-8192]
START=$[END-SIZE+2048-(END-SIZE)%2048]
else
START=$[END-SIZE+1]
fi

View File

@ -73,15 +73,17 @@ SECTORS=$(ogGetLastSector $1)
# Se recalcula el nº de sectores del disco 1, si existe partición de caché.
CACHEPART=$(ogFindCache 2>/dev/null)
[ "$ND" = "${CACHEPART% *}" ] && CACHESIZE=$(ogGetCacheSize 2>/dev/null | awk '{print $0*2}')
[ -n "$CACHESIZE" ] && SECTORS=$[SECTORS-CACHESIZE]
# Sector de inicio (la partición 1 empieza en el sector 63).
IODISCO=$(ogDiskToDev $1)
IOSIZE=$(fdisk -l $IODISCO | awk '/I\/O/ {print $4}')
if [ "$IOSIZE" == "4096" ]; then
START=4096
SECTORS=$[SECTORS-8192]
[ -n "$CACHESIZE" ] && SECTORS=$[SECTORS-CACHESIZE+2048-(SECTORS-CACHESIZE)%2048-1]
else
START=63
[ -n "$CACHESIZE" ] && SECTORS=$[SECTORS-CACHESIZE]
fi
PART=1
@ -127,6 +129,9 @@ while [ $# -gt 0 ]; do
# Error si se supera el nº total de sectores.
START=$[START+SIZE]
[ $START -le $SECTORS ] || ogRaiseError $OG_ERR_FORMAT "$[START/2] > $[SECTORS/2]" || return $?
if [ "$IOSIZE" == "4096" -a $PART -gt 4 ]; then
START=$[START+2048]
fi
PART=$[PART+1]
shift
done