update script to improve garage configuration
This commit is contained in:
2
conf/mount_disk.sh
Normal file → Executable file
2
conf/mount_disk.sh
Normal file → Executable file
@@ -1,4 +1,4 @@
|
||||
#!bash
|
||||
#!/bin/bash
|
||||
datadir=$1
|
||||
format=$2
|
||||
i=0
|
||||
|
||||
@@ -6,7 +6,7 @@ Wants=network-online.target
|
||||
[Service]
|
||||
User=__APP__
|
||||
Environment='RUST_LOG=garage=info' 'RUST_BACKTRACE=1'
|
||||
ExecStartPre=+__FINALPATH__/mount_disk.sh __FINALPATH__
|
||||
ExecStartPre=+__FINALPATH__/mount_disk.sh __FINALPATH__ __NBD_INDEX__
|
||||
ExecStart=__FINALPATH__/garage -c __FINALPATH__/garage.toml server
|
||||
StateDirectory=garage
|
||||
DynamicUser=true
|
||||
|
||||
20
conf/umount_disk.sh
Normal file → Executable file
20
conf/umount_disk.sh
Normal file → Executable file
@@ -1,16 +1,4 @@
|
||||
#!bash
|
||||
datadir=$1
|
||||
format=$2
|
||||
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 ))
|
||||
qemu-nbd --connect /dev/nbd$i $datadir/garage.qcow2
|
||||
if [[ "$format" = "true" ]]
|
||||
then
|
||||
mkfs.ext4 /dev/nbd$i > /dev/null
|
||||
fi
|
||||
mount /dev/nbd$i $datadir/data/
|
||||
#!/bin/bash
|
||||
nbd=$1
|
||||
umount /dev/nbd$nbd
|
||||
qemu-nbd --disconnect /dev/nbd$nbd
|
||||
|
||||
Reference in New Issue
Block a user