2013-07-07 14:58:03 +02:00
|
|
|
#!/bin/bash
|
|
|
|
### BEGIN INIT INFO
|
2013-11-21 16:58:21 +01:00
|
|
|
# Provides: expand-root
|
2013-07-07 14:58:03 +02:00
|
|
|
# Required-Start:
|
|
|
|
# Required-Stop:
|
|
|
|
# Should-Start:
|
|
|
|
# Should-Stop:
|
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop:
|
2013-11-21 16:58:21 +01:00
|
|
|
# Description: Expand the filesystem of the mounted root volume/partition to its maximum possible size
|
2013-07-07 14:58:03 +02:00
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
prog=$(basename $0)
|
|
|
|
logger="logger -t $prog"
|
|
|
|
|
2013-10-27 17:49:39 +01:00
|
|
|
device_path="/dev/xvda"
|
2013-07-07 14:58:03 +02:00
|
|
|
|
|
|
|
filesystem=`blkid | grep $device_path | sed 's#\(.*\):.*TYPE="\(.*\)".*#\2#'`
|
|
|
|
|
|
|
|
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
|