summaryrefslogtreecommitdiffstats
path: root/client/engine/Disk.lib
diff options
context:
space:
mode:
authorJuan Manuel Bardallo <juanmanuel.bardallo@sic.uhu.es>2019-03-26 12:04:01 +0100
committerRamón M. Gómez <ramongomez@us.es>2019-03-27 07:50:42 +0100
commit30fa5b494415c05d135f7b18e6eb44a48dbe2feb (patch)
tree239fac362ffa9973abf40a8ab0ad0dde8e009b1c /client/engine/Disk.lib
parentce1aa0b33271d3cad06ee52004f011d00195aebc (diff)
#906 Operations with partitions and images support NVMe
Diffstat (limited to 'client/engine/Disk.lib')
-rwxr-xr-xclient/engine/Disk.lib22
1 files changed, 17 insertions, 5 deletions
diff --git a/client/engine/Disk.lib b/client/engine/Disk.lib
index ac7aab5f..3ea01bbd 100755
--- a/client/engine/Disk.lib
+++ b/client/engine/Disk.lib
@@ -94,12 +94,18 @@ trap "rm -f $tmpsfdisk" 1 2 3 9 15
echo "unit: sectors" >$tmpsfdisk
echo >>$tmpsfdisk
+NVME_PREFIX=""
+if [[ $DISK == *"nvme"* ]]; then
+ NVME_PREFIX="p"
+fi
+
+
# Generar fichero de entrada para "sfdisk" con las particiones.
shift
while [ $# -gt 0 ]; do
# Conservar los datos de la partición de caché.
if [ "$ND $PART" == "$CACHEPART" -a -n "$CACHESIZE" ]; then
- echo "$DISK$PART : start=$[SECTORS+1], size=$CACHESIZE, Id=ca" >>$tmpsfdisk
+ echo "$DISK$NVME_PREFIX$PART : start=$[SECTORS+1], size=$CACHESIZE, Id=ca" >>$tmpsfdisk
PART=$[PART+1]
fi
# Leer formato de cada parámetro - Tipo:Tamaño
@@ -125,7 +131,7 @@ while [ $# -gt 0 ]; do
SECTORS=$[EXTSTART+EXTSIZE]
fi
# Generar datos para la partición.
- echo "$DISK$PART : start=$START, size=$SIZE, Id=$ID" >>$tmpsfdisk
+ echo "$DISK$NVME_PREFIX$PART : start=$START, size=$SIZE, Id=$ID" >>$tmpsfdisk
# Error si se supera el nº total de sectores.
START=$[START+SIZE]
if [ "$IOSIZE" == "4096" -a $PART -gt 4 ]; then
@@ -138,9 +144,9 @@ done
# Si no se indican las 4 particiones primarias, definirlas como vacías, conservando la partición de caché.
while [ $PART -le 4 ]; do
if [ "$ND $PART" == "$CACHEPART" -a -n "$CACHESIZE" ]; then
- echo "$DISK$PART : start=$[SECTORS+1], size=$CACHESIZE, Id=ca" >>$tmpsfdisk
+ echo "$DISK$NVME_PREFIX$PART : start=$[SECTORS+1], size=$CACHESIZE, Id=ca" >>$tmpsfdisk
else
- echo "$DISK$PART : start=0, size=0, Id=0" >>$tmpsfdisk
+ echo "$DISK$NVME_PREFIX$PART : start=0, size=0, Id=0" >>$tmpsfdisk
fi
PART=$[PART+1]
done
@@ -431,7 +437,13 @@ fi
# Si no se encuentra, procesa todos los discos para devolver su nº de orden y de partición.
n=1
for d in $(ogDiskToDev); do
- [ -n "$(echo $DEV | grep $d)" ] && echo "$n ${DEV#$d}" && return
+NVME_PREFIX=""
+if [[ $d == *"nvme"* ]]; then
+ NVME_PREFIX="p"
+fi
+
+
+ [ -n "$(echo $DEV | grep $d)" ] && echo "$n ${DEV#$d$NVME_PREFIX}" && return
n=$[n+1]
done
ogRaiseError $OG_ERR_NOTFOUND "$1"