blob: 36fa2858a3cb346157092a4f3076d0effe4a59e8 (
plain)
- #!/bin/sh
- set -e
- dev=$1
- newsize=$2
- lowsize=$3
- [ -n "$dev" ] || (echo "Device not provided"; exit 1)
- [ -n "$newsize" ] || (echo "New size not provided"; exit 1)
- #TODO: Get maxsize (from lvm) and oldsize (from fs), and check that...
- # maxsize >= newsize > oldsize
- # or
- # lowsize defined and lowsize < newsize < oldsize
- #TODO: Use getopts to enable onlineresize
- #TODO: Check if filesystem supports online resizing if requested
- [ "$onlineresize" = "yes" ] || umount $dev
- [ "$onlineresize" = "yes" ] || e2fsck -f $dev
- [ -n "$lowsize" ] && resize2fs $dev $lowsize
- lvresize -L $newsize $dev
- resize2fs $dev
- [ "$onlineresize" = "yes" ] || mount $dev
|