garage_ynh/conf/mount_disk.sh

20 lines
434 B
Bash
Raw Normal View History

#!/bin/bash
2022-10-06 09:46:45 +02:00
if [ "$VIRTUALISATION" = "true" ]
2022-07-30 14:02:57 +02:00
then
2022-11-29 14:57:52 +01:00
final_path=__FINALPATH__
2022-10-06 09:46:45 +02:00
format=$1
i=0
while $(fdisk -l /dev/nbd$i 1&>2 /dev/null)
do
i=$(( i + 1 ))
done
echo $i
modprobe nbd max_part=$(( i + 1 ))
2022-11-29 14:57:52 +01:00
qemu-nbd --connect /dev/nbd$i $final_path/garage_data.qcow2
2022-10-06 09:46:45 +02:00
if [[ "$format" = "true" ]]
then
mkfs.ext4 /dev/nbd$i > /dev/null
fi
mount /dev/nbd$i $datadir/data/
2022-07-30 14:02:57 +02:00
fi