bootstrap-vz/bootstrapvz/common/assets/init.d/expand-root
Jesse Szwedko 7f9ee9d22c Write Jessie growpart workaround script to something other than growpart
In case growpart is installed. Sed this workaround path into the init.d
script.

Signed-off-by: Andrew Garrett <andrew.garrett@getbraintree.com>
2016-01-12 19:12:57 +00:00

40 lines
975 B
Bash

#!/bin/bash
### BEGIN INIT INFO
# Provides: expand-root
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Description: Expand the filesystem of the mounted root volume/partition to its maximum possible size
### END INIT INFO
prog=$(basename $0)
logger="logger -t $prog"
growpart="growpart"
hash $growpart 2> /dev/null || {
$logger "$growpart was not found on PATH. Unable to expand size."
exit 1
}
root_device_path="/dev/xvda"
root_index="0"
$growpart $root_device_path $root_index || {
$logger "growpart failed. Unable to expand size."
exit 1
}
device_path="${root_device_path}${root_index}"
filesystem=$(blkid -s TYPE -o value ${device_path})
case $filesystem in
xfs) xfs_growfs / ;;
ext2) resize2fs $device_path ;;
ext3) resize2fs $device_path ;;
ext4) resize2fs $device_path ;;
*) $logger "The filesystem $filesystem was not recognized. Unable to expand size." ;;
esac