manila-test-image/server-files/usr/bin/manila-shrink

16 lines
300 B
Bash
Executable File

#!/bin/sh -e
# manila-shrink <cookie> <device> <size-in-gb>
NUM=$1
DEVICE=$2
SIZE_GB=$3
UUID=$(cat /metadata/$NUM/UUID)
sed "/$UUID/d" -i /etc/fstab
MNT_PATH=/shares/$NUM
umount $MNT_PATH
e2fsck -pf $DEVICE
resize2fs $DEVICE ${SIZE_GB}G
echo UUID=$UUID $MNT_PATH ext2 rw 0 2 >> /etc/fstab
mount -a